开发者

Create a report from word or pdf documents

开发者 https://www.devze.com 2023-03-22 03:21 出处:网络
My goal is to create report in WPF using dev express. I want to add word or pdf documents into report.

My goal is to create report in WPF using dev express. I want to add word or pdf documents into report.

For word documents, I am opening word document into RichEditControl, saving it into memory stream as rtf document and using XRRichText control, I am adding rtf document into report.

public void CreateReport()
{
    RichEditControl richEdit = new RichEditControl();
    MemoryStream stream = 开发者_Go百科new MemoryStream();
    XRRichText rtfDoc = new XRRichText();

    richEdit.LoadDocument(@"word document path", DocumentFormat.OpenXml);
    richEdit.SaveDocument(stream, DevExpress.XtraRichEdit.DocumentFormat.Rtf);

    rtfDoc.LoadFile(stream, XRRichTextStreamType.RtfText);
    rtfDoc.WidthF = 550F;

    this.Detail.Controls.Add(rtfDoc);
    this.RequestParameters = false;
    this.CreateDocument();
}

Is this a recommended way to add word document as rtf? and also, Instead of word document, how can I add pdf document into report?

Thank you!


Check the XtraRichEdit - Document Server (available now in v2011, volume 1) blog post, which may be helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消