Unplanned
Last Updated: 04 Jun 2025 12:57 by Daryl
Daryl
Created on: 04 Jun 2025 12:57
Type: Bug Report
0
Truncated text in rendered reports when Spire.Office is used with Reporting

I am rendering reports locally using the report processor. When I use the RenderReport method after processing MS Office Documents and PDF files with the Spire. Office, it causes the text of the report rendered with Telerik Reporting to get truncated:

using Telerik.Reporting;

Spire.Doc.Document document = new Spire.Doc.Document();

var wordDocPath = "./wordtest.docx";
var pdfFilePath = System.IO.Path.Combine("../../../", "wordtest.pdf");

document.LoadFromFile(wordDocPath);

Spire.Doc.ToPdfParameterList toPdf = new Spire.Doc.ToPdfParameterList();
//toPdf.AutoFitTableLayout = true;
document.SaveToFile(pdfFilePath, toPdf);
document.Close();

var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
var reportPackager = new ReportPackager();

string sourceReportFile = "./Static Broken CSU Analysis.trdp"; ;

using (var sourceStream = System.IO.File.OpenRead(sourceReportFile))
{
    var report = (Report)reportPackager.UnpackageDocument(sourceStream);

    var deviceInfo = new System.Collections.Hashtable();

    var reportSource = new InstanceReportSource();

    reportSource.ReportDocument = report;

    Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);


    if (!result.HasErrors)
    {
        string fileName = result.DocumentName + "." + result.Extension;
        string filePath = System.IO.Path.Combine("../../../", fileName);

        using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
        {
            fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
        }
    }
}

If I comment out the section that is converting the totally unrelated word file to pdf and run it again, it does not clip.

0 comments