Try to get PrintSettings

edited 4:52AM 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 4:52AM
    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 4:52AM
    Thank you.

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

Leave a Comment