Printing Row and Column Headings

Hi, it appears when I use the SheetRender object to try to convert to images or send to a printer, the Row and Column headings are not showing despite the page setup option being true. I did a quick search and found the following article:


http://www.aspose.com/community/forums/191967/sheet2image-to-include-the-row-heading-and-column-headings/showthread.aspx#191967

I’m using the latest version of Aspose.Cells for .NET. Any thoughts?

Doug


Hi George,

Thanks for considering Aspose.Cells. I have tested the scenario and Aspose.Cells works fine for your issue. Please try the code with the latest version of Aspose.Cells v5.2.0.1, from following link you can download the new version.

http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry269971.aspx

Code:
string path = @“D:\TestFiles\image”;
ImageOrPrintOptions imageoption = new ImageOrPrintOptions();
imageoption.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
imageoption.OnePagePerSheet = true;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
SheetRender sr = new SheetRender(worksheet, imageoption);
for (int i = 0; i < sr.PageCount; i++)
{
sr.ToImage(i, path + i + “.” + System.Drawing.Imaging.ImageFormat.Jpeg);

}
or you can try the below code as well

string path = @“D:\TestFiles\image”;
ImageOrPrintOptions
imageoption = new ImageOrPrintOptions();
imageoption.OnePagePerSheet = true;
imageoption.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
SheetRender src = new SheetRender(
worksheet, options);
src.ToImage(0, path + “.” + System.Drawing.Imaging.ImageFormat.Jpeg);

Both works perfect for reference please find attache the sample file and image files generated above codes.


Hi,

I think Masrat misunderstands you. I can understand your issue, you mean to say that when a worksheet has printing attribute “Row and column headings” ON (Open PageSetup dialog box in MS Excel, click Sheet tab and then click the check box i.e. “Row and column headings”), SheetRender does not render the image with rows/cols headings similar to print preview in MS Excel. To enable this option by using Aspose.Cells API, one can add the line:
worksheet.PageSetup.PrintHeadings = true;

I have logged your issue (for SheetRender API) into our issue tracking system with an id: CELLSNET-22126. We will fix the issue asap.

I think, temporarily, you may use the old obsoleted method Worksheet.SheetToImage() that doe support printing rows/cols headings in the generated images.
e.g
worksheet.SheetToImage(“e:\test\outputImg.jpg”, System.Drawing.Imaging.ImageFormat.Jpeg);


Thank you.

Hi Amjad,


Thank you for the response. SheetToImage is not going to work for my program because I need the ability to send it to an actual printer. Fixing the issue will be extremely helpful for my program.

Regards,

Doug

Hi Doug,

Sure, we will fix the issue for SheetRender API. Once we have figured it out, we will let you know.

Thank you.

Hi Amjad,

Has there been any progress on this over the past year? The SheetToImage() option isn’t an option for our workflow as the ImageFormat class doesn’t support PDF.

Thanks,
Paul

Hi,

Could you please download and try: Aspose.Cells for .NET v7.0.4.6
This is our latest version/fix, we made several improvements in later versions of the product. If you still find the issue let us know with template file(s), sample code etc.

Thank you.

Thank you Amjad - 7.0.4.6 addresses the issue, plus another smaller problem.

FYI: The current (Jan 10) Aspose.Total download still has 7.0.4.0).

Thanks
/paul

Hi,

It’s actually a minor version i.e v7.0.4.6

Each version has this format X.X.X.Y

If the Y=0 then it is a major version
and if Y>0 then it is a minor version.

When we will release a major version, we will update Aspose.Total with it.

Hi,

We recommend you to kindly try latest version v7.1.0:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry355234.aspx