setting the table width

4 posts, 0 answers
  1. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 29 May 2011 Link to this post


    (sorry the title doesn't match my question. i posted a question a while ago, but it was already solved so i just updated it with another question)

    how can i save a file automatically to a directory. i have a code that saves a file but it uses a save file dialog. how can i save it without showing the savefile dialog?

    //here's my code that uses a save file dialog

    SaveFileDialog dialog = new SaveFileDialog();
    dialog.DefaultExt = "*.html";
    dialog.Filter = "WORD Document (*.html)|*.html";

    if (dialog.ShowDialog() == true)
        RadDocument document = CreateDocument(rgvReportData);

        document.LayoutMode = DocumentLayoutMode.Paged;

        document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize));
        document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(2, 2, 2, 2);
        document.SectionDefaultPageOrientation = PageOrientation.Landscape;
        HtmlFormatProvider provider = new HtmlFormatProvider();

        using (Stream output = dialog.OpenFile())
            provider.Export(document, output);
  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 01 Jun 2011 Link to this post

    Hello Angeli,

    You cannot save files on the client in any other way than the SaveFileDialog due to Silverlight's security policy. If you want to save the file on the server, you can either export the content of the document to a stream in the Silverlight application and use a WebClient to pass the stream to the server or use the WPF assemblies in the ASP project and export the document there. There is a demo with RadRichTextBox and WCF services, which you mind find helpful, in this forum thread.

    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 R3 2016 release webinar banner
  4. Armysniper
    Armysniper avatar
    61 posts
    Member since:
    Mar 2005

    Posted 06 Jun 2012 Link to this post

    Sorry to open this back up but is there no way to keep the savefile dialog's stream open and continue to write to it? For example, if I want to implement autosave to a file on the desk after they already selected to manually save once is this possible?
  5. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 08 Jun 2012 Link to this post

    Hi Shannon,

    It is not possible to cheat Silverlight in this way. The framework does not allow communication with files on the client without user interaction by design. In addition, opening and saving files is restricted to using the Open and SaveFileDialog and accessing their streams after the dialog has been closed is not possible.

    Iva Toteva
    the Telerik team

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

Back to Top