Malformed Japanese dates after PDF conversion

Dear Aspose team,

We have an Excel file in format, containing some Japanese dates.

After printing to PDF the dates become malformed. Instead of a date in a cells there are ‘#’ symbols.

Tested with Aspose.Cells for .NET versions: 20.5.0 and 21.6.0

With the IsFontSubstitutionCharGranularity setting enabled in PdfSaveOptions dates are converted as expected.

We found it risky to enable this setting because it is not entirely clear how it might affect the conversion for our clients.

Is the result of the conversion expected in this case or is it a bug?

Here is the simple code example to reproduce the problem:

/// <summary>
/// Convert excel file to pdf using Aspose.Cells
/// </summary>
/// <param name="srcFileName">input excel file name for conversion</param>
/// <param name="dstPdfFileName">result pdf file name</param>
static void ConvertExcelFileToPDF(string srcExcelFileName, string dstPdfFileName)
{
    var inputStream = File.OpenRead(srcExcelFileName);
    var outputStream = File.Create(dstPdfFileName);

    Workbook workbook = null;
    var options = new LoadOptions();
    workbook = new Workbook(inputStream, options);
    workbook.Settings.ReCalculateOnOpen = false;

    var tmpStream = new MemoryStream();
    var saveOptions = new PdfSaveOptions
    {
        //IsFontSubstitutionCharGranularity = true,       // Uncomment this line to fix the date conversion         
    };
    workbook.Save(tmpStream, saveOptions);
    tmpStream.Seek(0, SeekOrigin.Begin);
    tmpStream.CopyTo(outputStream);

    inputStream.Dispose();
    outputStream.Dispose();
}

I attached the input example Excel file and 2 PDF files after conversion with malformed date ‘Japanese Date Test default.pdf’ and with enabled settings IsFontSubstitutionCharGranularity ‘Japanese Date Test with IsFontSubstitutionCharGranularity.pdf’:
Publishing Japanese dates.zip (21.6 KB)

Best regards,
Vitaly Kvashin.

@VitalyKvashin,

Thanks for the template file.

Please try using our latest version/fix: Aspose.Cells for .NET v22.11 (Download | NuGet). I have tested your scenario/case using your template file and sample, it works fine. The output PDF is fine tuned.

Let us know if you still find the issue with latest version/fix.

1 Like