Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
490
UltraPrintDocument KB08278
posted

Hello,

I would like to be able to print the contents of an UltraFormattedTextEditor.
In the knowledge base article http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=8278
under the UltraPrintDocument section it says there is a sample custom printdocument.

If anyone could tell me where to find this sample, or better yet if there is already support for printing UFTE contents, I would be very greatful.

 

Parents
  • 3707
    posted

    Okay, after playing around I've discovered something interesting. The UltraFormattedTextEditor creates HTML, but not every tag that it creates is supported by the AddRichContent method. This is definately something that needs submitted as a feature request. Here was the code I used to play around in my testing:


    Infragistics.Documents.Report.Report report = new Infragistics.Documents.Report.Report();

    // MBS 1/11/08 - BR29211

    report.Preferences.Printing.PaperSize = Infragistics.Documents.Report.Preferences.Printing.PaperSize.Auto;

    report.Preferences.Printing.PaperOrientation = Infragistics.Documents.Report.Preferences.Printing.PaperOrientation.Auto;

    report.Preferences.Printing.FitToMargins = true;

    Infragistics.Documents.Report.Section.ISection section = report.AddSection();

    section.PageSize = Infragistics.Documents.Report.PageSizes.Letter;

    section.PageMargins.All = 35;

    section.PageNumbering =
    new Infragistics.Documents.Report.Section.PageNumbering();

    section.PageNumbering.Style = new Infragistics.Documents.Report.Text.Style(Infragistics.Documents.Graphics.Fonts.Arial, Infragistics.Documents.Graphics.Brushes.Black);

    section.PageNumbering.Template = "Page [Page #] of [TotalPages]";

    section.PageNumbering.Continue = true;

    section.PageNumbering.SkipFirst = false;section.PageNumbering.Alignment = Infragistics.Documents.Report.PageNumberAlignment.Right;

    section.PageNumbering.OffsetX = -10;

    Infragistics.Documents.Report.Text.IText text = section.AddText();

    Infragistics.Documents.Report.Text.Style normalStyle = new Infragistics.Documents.Report.Text.Style(new Infragistics.Documents.Graphics.Font("Arial", 12), Infragistics.Documents.Graphics.Brushes.Black);

    text.Style = normalStyle;

    text.AddRichContent(ultraFormattedTextEditor1.Value.ToString()); report.Publish("thereport.pdf", Infragistics.Documents.Report.FileFormat.PDF);

    System.Diagnostics.Process.Start("thereport.pdf");


    If it's really an emergency I'm sure you could take the manual route and further parse that formatted text editor value to replace the tags with supported tags or even capture the hotkeys to place the support tags instead of the SPAN tag it creates, then you'd be all set. These are the tags that the AddRichContent method supports:

    • <b>
    • <i>
    • <u>
    • <font face="..." name="..." size="..." color="...">
    • <a href="..." mce_href="...">
    • <br>
    • <img width="..." height="..." align="...">
Reply Children