Hi, I’m running into some issues with sheet2imagebypage function. The error: Index was out of range. Must be non-negative and less than the size of the collection… I’ve attached the xls file for you. This error occurred on worksheet [AE Result]. Also, I used the chart.toImage() function to get the charts in worksheet [Trend] and the charts doesn’t look like it at all. Can you help me fix it. Thank you.
Hi,
I have tested your scenario with the attached version v4.9.0.2 and it works fine.
You may use the following sample code with the attached version.
Sample code:
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
// imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
Workbook book = new Workbook();
book.Open(“e:\test\11145.xls”);
Worksheet sheet = book.Worksheets[“AE Results”];
SheetRender sr = new SheetRender(sheet, imgOptions);
int sheetPageCount = sheet.GetPageCount(imgOptions.PrintingPage);
for (int j = 0; j < sheetPageCount; j++)
{
// sr.ToImage(j, “e:\test\srrimage” + j.ToString() + “.tif”);
sr.ToImage(j, “e:\test\srrimage” + j.ToString() + “.emf”);
}
Note: WordArt objects would not be rendered in the output image, so these objects would be excluded. We will support them in future versions though.
Thank you.
Hi, I tested the code that you provided. The issue is that I need to provide row and column headings and margins for all sides, and other printer related options. So far, the SheetToImageByPage(tmpDirectory, options), allows me to use the options to convert to the desired tiff images. Can you add to the SheetRender object to apply the other printer options please. The requirement for me is to convert excel files to tiff images and user can select print options and these print options will reflect on these tiff images. Also, allow user the option to extract all charts and pictures from the excel file and convert those charts and images to tiff with tiff compression and the ability to enlarge to fit into a papersize (each tiff is set to a papersize). Please help. Thanks.
Another thing that I noticed is that if a row has color on the background like alternating row coloring, the colored row is blacked out on the tiff images. Is there something I can do about it so the data shows. Thanks.
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 300;
options.VerticalResolution = 300;
options.TiffCompression = TiffCompression.CompressionCCITT4;
options.PrintingPage = PrintingPageType.IgnoreStyle;
options.ImageFormat = ImageFormat.Tiff;
options.IsCellAutoFit = true;
Hi,
Thanks for sharing the details.
I have logged it into our issue tracking system with an issue id: CELLSNET-16236. We will soon look into it and get back to you soon.
Thank you.
Hi,
Please try the attached version.
1) Well, the WorkbookRender can render whole workbook to tiff images for printing.Thank you.
2) For “and the colored row is blacked out”, it is caused by black and white color mode set by the compressionCCITT4 compression type, so, please use CompressionLZW instead.
3) For "Also, allow user the option to extract all charts and pictures from the excel file and convert those charts and images to tiff with tiff compression and the ability to enlarge to fit into a papersize (each tiff is set to a papersize)."
Please set Aspose.Cells.ImageOrPrintOptions.OnePagePerSheet = true; before rendering to Tiff.
The issues you have found earlier (filed as 16236) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
I tried to use the latest update. But the charts are still not displaying correctly.
Worksheet: “Incentives - graphs” bars doesn’t show in the image.
Worksheet: “Incentives - graphs #1” is blank
Worksheet: “Incentives - graphs #2” is blank
Worksheet: “Directions” has a picture. That should be extracted from the worksheet and display as another tiff images.
Can you provide sample code on how to use the new fix features please? Thank you.
Hi,
For your template “11145.xls” file you posted in your first post in this thread, we do not find any issues except for WordArt. We do not support it rendering it to pdf format as we mentioned in my previous reply.
For:
"I tried to use the latest update. But the charts are still not
displaying correctly.
Worksheet: “Incentives - graphs” bars doesn’t
show in the image.
Worksheet: “Incentives - graphs #1” is blank
Worksheet:
“Incentives - graphs #2” is blank
Worksheet: “Directions” has a
picture. That should be extracted from the worksheet and display as
another tiff images.
"
Please post your template file(s) here to show the issues, we will check it soon.
Thank you.
I’m sorry. I was using a different excel. I have attached the sample excel for you. Please take a look again. Thank you.
Hi,
Thanks for providing us the template file.
After an initial test, I can reproduce the issues you have described. We will further investigate your issues and let you know about it soon.
I have logged your issue as an issue id: CELLSNET-16660 in any case.
Thank you.
Hi,
Please try the attached version, we have fixed your mentioned issue(s).
Thank you.
Hi, I try this version. I see some improvement on the chart images. There are still a few charts that doesn’t match. Another issue is the page size is no long correct. I had the tiff images set to 8.5 x 14. The tiff images are all random size now. I try both sheet2imagebypage and sheetrender. both objects had incorrect page size. I used the following options.
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 300;
options.VerticalResolution = 300;
options.TiffCompression = TiffCompression.CompressionCCITT4;
options.PrintingPage = PrintingPageType.IgnoreStyle;
options.ImageFormat = ImageFormat.Tiff;
options.IsImageFitToPage = true;
options.IsCellAutoFit = true;
options.OnePagePerSheet = true;
chart.PageSetup.BlackAndWhite = true;
chart.PageSetup.TopMarginInch = 0.75;
chart.PageSetup.BottomMarginInch = 0.75;
chart.PageSetup.LeftMarginInch = 0.25;
chart.PageSetup.RightMarginInch = 0.25;
chart.PageSetup.PrintQuality = 300;
chart.PageSetup.PrintGridlines = true;
chart.PageSetup.PrintHeadings = true;
chart.PageSetup.PaperSize = PaperSizeType.Paper11x17;
chart.PageSetup.Orientation = PageOrientationType.Landscape;
chart.PageSetup.Order = PrintOrderType.OverThenDown;
chart.ToImage(imagePath, options);
Please provide me with a sample code and options that you used. Thank you.
Hi,
1) Please set every sheet page to the same PaperSize, otherwise the
result would be set according to PageSetup and printer settings.
2) Could you elaborate which part of chart does not match? Please give us details, you may attach template files for your issues.
Thank you.
I set the paper size in PageSetup. I attached my code and printer settings for you to review. Can you point out where I’m doing wrong?
Hi,
We have checked your provided code segment. We think some code throw exception before
setting papersize when you go through every worksheet. So, the paperSize is
not set correctly. Kindly print every paperSize of worksheet to make
sure that the paperSize is set.
Thank you.
Can you give me a sample code to show how to set up the paper size for worksheets?
Hi,
Here is the sample code segment for your reference:
foreach (Worksheet ws in workbook.Worksheets)
{
//make sure do not write such code that throws exception before setting paper size
ws.PageSetup.PaperSize = PaperSizeType.PaperA4;
//do other thing
}
Thank you.
The issues you have found earlier (filed as 16660) 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.