Managing save to disks/ Opening from server

4 posts, 0 answers
  1. Armysniper
    Armysniper avatar
    61 posts
    Member since:
    Mar 2005

    Posted 06 Jun 2012 Link to this post

    Hey everyone, I have a three part question:

    1. When a document is opened from the client's machine to the richtextbox (operating like MS Word) is there a way to have it so the "save" button simply saves the document to the current copy (like it normally does in word) vice "save as" which prompts for a new name/location/etc?


    2. I would like to open a document from the server in the richtextbox when the user selects it and when the user clicks save it then saves it back to the server but save as will prompt a new filename/type on the client machine. Is this possible?


    3. Is it possible to configure an auto save on an interval?

    Thanks guys/gals, I appreciate your help!


    Edit: Oh one more question how do you set the default page margins on load like you change them in Page View tab?
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 07 Jun 2012 Link to this post

    Hello Shannon,

    It is not possible to open or save a document on the client machine without using the Open and SaveFileDialogs. If you would like to have the files saved on the server and opened from there, you can implement that using WCF services.
    There are two examples of the usage of RadRichTextBox with WCF services in this forum post - one using a format provider and one using a data provider. You can see how the document can be exported on demand and how data-binding works. If you would like, you can have the export scheduled to occur on particular intervals or change the UpdateSourceTrigger of the data provider.

    When it comes to the buttons and backstage items in the RibbonUI that open and save the document on the client, you can remove them altogether or just delete the commands they are bound to, e.g. delete the following bindings from the XAML:

    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}"
    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=OpenDocumentCommand}"

    As for changing the default page margin, this can be done as described here.

    I hope this helps.

    Greetings,
    Iva Toteva
    the Telerik team

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

  3. DevCraft banner
  4. Armysniper
    Armysniper avatar
    61 posts
    Member since:
    Mar 2005

    Posted 09 Jun 2012 Link to this post

    That does yes. If I can't write to the local file system then how would I got about writing it to Isolated Storage as a .docx, pdf, etc?
  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 12 Jun 2012 Link to this post

    Hi Shannon,

    You can read more about IsolatedStorage in MSDN.

    Overall, the code you can use to export to an IsolatedStorage file may be something like this:

    string fileName = "IsolatedStorageFile.docx";
    IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
    //or
    //IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForSite();
    using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(fileName, FileMode.Create, isolatedStorageFile))
    {
        DocxFormatProvider docxProvider = DocumentFormatProvidersManager.GetProviderByExtension("docx") as DocxFormatProvider;
        docxProvider.Export(this.RadDocument, fileStream);
    }


    All the best,
    Iva Toteva
    the Telerik team

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

Back to Top