Try to get PrintSettings

edited 6:10AM in FastReport .NET
Hi,

Our client would like to save PrintSettings like PrintMode, PagesOnSheet, etc from PrintDialog.

I know that I can set PrintMode, PagesOnSheet from code.
Is there any way to read those properties from PrintDialog ? (if yes I can save them to data base and use them next time and set in code)

Comments

  • edited 6:10AM
    everytime you attach report object to PreviewControl:
    if (previewControl1.Report != null)
    {
        FastReport.PrintSettings settings = previewControl1.Report.PrintSettings;                
        System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(FastReport.PrintSettings));
        using (System.IO.TextWriter writer = new System.IO.StreamWriter(@"d:\printersetting.xml"))
        {
            serializer.Serialize(writer, settings);
        }
        previewControl1.Clear();
        previewControl1.Report.Dispose();
    }
    
    FastReport.Report report = new FastReport.Report();
    // unfortunately, we can't deserialize to report.PrintSettings 
    report.Preview = previewControl1;
    report.Load("frxfile");
    report.RegisterData(dataSet);
    report.Show();
    

  • edited 6:10AM
    Thank you.

    But I found, if I change in designer 'Printer Setup' those options are save inside .frx, so problem solved >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.