SheetRender Creates Blank Pages But Excel Does Not

Previously we have been using SheetToImageByPage. Because of CELLSNET-16744, we now have to switch to using SheetRender and we are finding problems that do not exist in SheetToImageByPage. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

While Aspose.Cells update 4.9.1.4 fixed the SheetRender problem reported in 16744, we have found that blank pages are not properly ignored by SheetRender.

Using code like this:

Workbook book = new Workbook();

book.Open(fullPath);

imgOptions = new ImageOrPrintOptions();

imgOptions.ImageFormat = ImageFormat.Tiff;

imgOptions.HorizontalResolution = 200;

imgOptions.VerticalResolution = 200;

imgOptions.TiffCompression = TiffCompression.CompressionCCITT4;

imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;

int bookPageCount = 0;

for (int i = 0; i < book.Worksheets.Count; i++)

{

Worksheet sheet = book.Worksheets[i];

if (settingOrientation) sheet.PageSetup.Orientation = orientation;

if (settingZoom) sheet.PageSetup.Zoom = zoom;

if (settingPrintGridlines) sheet.PageSetup.PrintGridlines = printGridlines;

if (settingAutoFitColumns) sheet.AutoFitColumns();

if (settingAutoFitRows) sheet.AutoFitRows();

if (imgOptions.TiffCompression == TiffCompression.CompressionCCITT4)

{

foreach (Cell cell in sheet.Cells)

{

cell.Style.Font.Color = Color.Empty;

cell.Style.ForegroundColor = Color.Empty;

cell.Style.BackgroundColor = Color.Empty;

cell.Style.Pattern = BackgroundType.None;

}

}

SheetRender sr = new SheetRender(sheet, imgOptions);

int sheetPageCount = sr.PageCount;

string subPageName = string.Empty;

for (int j = 0; j < sheetPageCount; j++)

{

sr.ToImage(j, "image" + i.ToString() + "_" + j.ToString() + ".tif");

}

bookPageCount += sheetPageCount;

}

With this code, blank pages are being created. If you print the XLS directly from Excel, blank pages do not appear. Using the SheetToImageByPage method, blank pages do not appear.

I have attached sample XLS files and the resulting TIF files when converted by SheetRender.

With the first XLS file, MS Excel prints only 1 page. SheetRender creates 2 pages. The second page contains one empty cell.

With the second XLS file, Excel prints only 5 pages. SheetRender creates 6 pages. The last page is blank.

Please review.

Thank you,

Robert.

Hi Robert.

Thanks for providing us the template files with sample code.

After an initial test, we have found the issue. We will figure it out soon.

I have logged your issue into our issue tracking system with an issue id: CELLSNET-17003. Once it is sorted out we will let you know about it.

Thank you.

Hi,

We have fixed your mentioned issue, kindly try the attached version.

Thank you.

Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

This update appears to fix the blank page problem. We have discovered a new problem and have started a new thread about it. “SheetRender Does Not Properly Format Numeric Cells Rendered to TIF”

Thank you,

Robert

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

For your newly created thread, we have found the issue and replied in the respective thread. We will update you as soon as the fix is available.

Thank You & Best Regards,

The issues you have found earlier (filed as 17003) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

While trying to keep the API as straightforward and clear as possible, we have decided to recognize and honor the common development practices of the platform; we have re-arranged API Structure/ Namespaces.

With this release, we have reorganized the API classes for Aspose.Cells component. This change has some major aspects that we follow. We have added new namespaces. The entire API (classes, interfaces, enumerations, structures etc.) were previously located in the Aspose.Cells namespace. Now, certain sets of API have been moved to their relative namespaces, which make the relationship of classes (with their members) and namespaces clear and simplified. It is to be noted here, we have not renamed existing API (classes, enumerations etc.) but, I am afraid you still need to make certain adjustments in your existing projects accordingly.

For complete reference, please see the product's API Reference.