This is a migrated thread and some comments may be shown as answers.

Managing save to disks/ Opening from server

3 Answers 95 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Raventhorn
Top achievements
Rank 2
Raventhorn asked on 06 Jun 2012, 04:14 PM
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?

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 07 Jun 2012, 04:02 PM
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 >>

0
Raventhorn
Top achievements
Rank 2
answered on 09 Jun 2012, 07:15 PM
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?
0
Iva Toteva
Telerik team
answered on 12 Jun 2012, 12:31 PM
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 >>

Tags
RichTextBox
Asked by
Raventhorn
Top achievements
Rank 2
Answers by
Iva Toteva
Telerik team
Raventhorn
Top achievements
Rank 2
Share this question
or