We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Render CSV files no longer works after version 21.4

Hi,

My code is no longer working for CSV files after updating from version 21.4 to 22.1.
I saw the release notes here, but I couldn’t find any example code:

My sample code for convert to PDF:

var loadOptions = new TxtLoadOptions(LoadFormat.Csv) { Separator = ‘;’ };
var doc = new Workbook(inputFile, loadOptions);
doc.Save(outputFile, SaveFormat.Pdf);

My sample code for Render:

var loadOptions = new TxtLoadOptions(LoadFormat.Csv) { Separator = ‘;’ };
var doc = new Workbook(inputFile, loadOptions);

var imageOrPrintOptions = new ImageOrPrintOptions
{
OnePagePerSheet = false,
AllColumnsInOnePagePerSheet = false,
HorizontalResolution = (int)Math.Round(180d),
VerticalResolution = (int)Math.Round(180d),
};
var renderer = new SheetRender(doc.Worksheets[0], imageOrPrintOptions);
Console.WriteLine(renderer.PageCount);

Here renderer.PageCount is always 0!. So, there is no sense to continue with the rendering.

Please help. This functionality is important for us.

Attached is a sample CSV file.
test_semicolon.zip (7.6 KB)

Best Regards,
Vassil

@DWProject,

Please try our latest version/fix: Aspose.Cells for .NET v22.1.1.
Aspose.Cells22.1.1 For .Net2_AuthenticodeSigned.Zip (5.6 MB)
Aspose.Cells22.1.1 For .Net4.0.Zip (5.6 MB)
Aspose.Cells22.1.1 For .NetStandard20.Zip (5.6 MB)

I have tested using your sample file and following sample code, it works and as expected:
e.g.
Sample code:

var loadOptions = new TxtLoadOptions(LoadFormat.Csv) { Separator = ';' };
var doc = new Workbook("e:\\test2\\test_semicolon.csv", loadOptions);
doc.Save("e:\\test2\\out1.pdf", SaveFormat.Pdf);

//My sample code for Render:
var loadOptions1 = new TxtLoadOptions(LoadFormat.Csv) { Separator = ';' };
var doc1 = new Workbook("e:\\test2\\test_semicolon.csv", loadOptions1);
var imageOrPrintOptions = new ImageOrPrintOptions
{
                    OnePagePerSheet = false,
                    AllColumnsInOnePagePerSheet = false,
                    HorizontalResolution = (int)Math.Round(180d),
                    VerticalResolution = (int)Math.Round(180d),
};
                
var renderer = new SheetRender(doc1.Worksheets[0], imageOrPrintOptions);
Console.WriteLine(renderer.PageCount);//15 - Ok 

Let us know if you still find any issue.

Great! That was a very fast fix.

Thanks a lot!

@DWProject,

You are welcome.