I need to store text documents

8 posts, 0 answers
  1. Compactis
    Compactis avatar
    3 posts
    Member since:
    Apr 2009

    Posted 23 Jun 2011 Link to this post

    Hello,

    I would need your help with following problem:

    Assignment:

      1 – I need to store text documents (docx or rtf) and image files in the database - it's OK.

      2 - then I need to display these data in the form RadBook in Silverlight on the Web.

    When I use for displaying a docx document, so it is good, but the file is too large (10 to 20 MB- ...) and then I need to extend this document (add new pages) with the fact that it is not possible change the existing content.

    The second option is to store the pages separately as ??? (rtf, docx), and then stretching it while turning pages in RadBook.

    I ask you to help to solve this. How to use specific components to use(write) one of above mentioned variants. Preferably the second one ( to read each page through WS).

    How shall I write this view in the code (XAML) with the option to enlarge this page in a new window?

    Thank you very much.

    Regards

  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 29 Jun 2011 Link to this post

    Hi DutchSoft,

    Looks like you can use RadDocument in your scenario. Here is what you can do:
    • Create RadDocuemnt from you docx or rtf document using FormatProviders. You can read more on  how to use format providers in this article.
    • Show the imported document in RadBook using the DocumentViewManager and RadRichTextPageView classes. You can take a look in this example which does exactly the same. Note that when shown in RadBook, the document will be read-only, so the users will not be able to change its content directly.
    • You can still alter the document from code using the RadDocument API. This way you will be able to add/remove pages if you need to.
    I hope this was helpful. Please write us again if you need further assistance.

    Greetings,
    Alex
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Compactis
    Compactis avatar
    3 posts
    Member since:
    Apr 2009

    Posted 04 Jul 2011 Link to this post

    Thank you for your reply.
    One more issue: One page will be docx, the second also, but the third page could be a scanned image (jpeg). How to use this. Could you please write me an example of code (I am a beginner in Silverlight) of removing and adding pages?
    Thank you
  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 08 Jul 2011 Link to this post

    Hi Dutchsoft,

    RadDocument makes what is needed to layout its content among the pages. All you need to do is insert the new content in the current document - be it text or image.
    Unfortunately, parts of the document cannot be deleted unless a code-behind RadRichTextBox is instantiated and the methods from its API are used.
    Please find attached a sample demo illustrating how this can be done.
    I hope this helps.

    Greetings,
    Iva
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. Compactis
    Compactis avatar
    3 posts
    Member since:
    Apr 2009

    Posted 20 Jul 2011 Link to this post

    Thank you very much. This solves my problem and deepens my Rad component knowledges.
    Just another issue: I would need to create an offline book from this way generated book. I thought it could be generated through HTML.
    It means: to download all the necessary pages and to create of them pictures. But I have a problem with creating of pictures from XAML. Is there any elegant solution? Or even from DOCX?
    Thank you very much.
    Petr Jůna
    DutchSoft
  7. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 26 Jul 2011 Link to this post

    Hi Dutchsoft,

    Generating pictures from the document is not a feature supported out-of-the-box.
    What you can do is to use RadRichTextPageView and WriteableBitmap to generate the images. RadRichTextPageView is needed, so that you can get the separate pages of the document and take "screenshots" of them with WriteableBitmap.
    Please find attached a sample demo illustrating the approach. You can just run it and see the resulting images, which will get added to the main page.

    Best wishes,
    Iva
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  8. Petr Juna
    Petr Juna avatar
    2 posts
    Member since:
    Apr 2010

    Posted 27 Jul 2011 Link to this post

    Thank you very much.
    One more question. How do I view only one page from an already loaded RadBook control. Do I need to zoom the page. Or another way to zoom.
     Thank you
     Dutchsoft

    Sorry for the translation, Google translates it to me.
  9. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 01 Aug 2011 Link to this post

    Hello Petr,

    For your particular scenario you can use the Silverlight's Transforms. More information can be found here.

    Regards,
    Kiril Stanoev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top
DevCraft banner