Aspose Cell .net 核心:某些文本在 linux 主机上被截断

Aspose Cell .net core: Some text is cut off on linux host

我在 .net 核心平台上使用 aspose 开发导出功能时遇到问题。问题是某些导出为 PDF 的行数据被截断了。

我在本地环境 (windows) 上试过没有问题。结果和我预想的一样好

但是当我将代码发布到主机环境 (linux) 时,结果似乎不对。

我的本地结果 (windows)

我的托管结果 (linux)

这是我用来生成文件的一段代码

public FileData ExportToFile(DataTable data, string format, string query)
    {
        var workbook = new Workbook();
        var style = workbook.CreateStyle();
        workbook.DefaultStyle = style;

        var sheet = workbook.Worksheets[0];

        AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = true };

        data = _RemoveFormat(data); // Parse all data to String
        
        /**/
        
        sheet.PageSetup.Orientation = PageOrientationType.Landscape;
        
        PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
        pdfSaveOptions.AllColumnsInOnePagePerSheet = true;
        sheet.AutoFitRows(oAutoFitterOptions);
        sheet.AutoFitColumns(oAutoFitterOptions);
        
        workbook.Save(stream, pdfSaveOptions);
        
        /**/
    }

与 Aspose 支持人员讨论后。我发现差异是由我的托管服务器 (linux) 中缺少的字体引起的。所以我需要在服务器上安装它来使两个文档具有相同的样式。

在我的例子中,我的应用程序托管在 kubernetes 集群中,所以我需要在 dockerfile

中添加这行命令
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections

RUN apt-get update \
    && apt-get install -y --allow-unauthenticated \
        fontconfig \
        ttf-mscorefonts-installer