Create a report from word or pdf documents
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.
精彩评论