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

Free Support Forum - aspose.com

Printing Issue When Convert to the image

Hello Support,
I am using the Aspose.Cells for Creating the excel Workbook contain the multiple sheet, the excel is generating in the right Format but when i convert it into the image for Insertion into the word document it having formatting issue .
The Attach Document The First one is Excel_Print.xps is the Print output of the Excel sheet
where as the second one Genrated_doc Image is the Image output of the sheet in the word doc.

As you check both the output you find that in the Print Version the Grid lines are not present always.
but in the image version they are present.

below lines of code i am using for the Workbook to Image Conversion and insertion.

foreach (Worksheet sheet in book.Worksheets)
if (loopCount <=counts)

sheet.PageSetup.Orientation = PageOrientationType.Landscape;
//sheet.PageSetup.FooterMargin = 0;
//sheet.PageSetup.RightMargin = 0;
//sheet.PageSetup.TopMargin = 0;
//sheet.PageSetup.BottomMargin = 0;
sheet.PageSetup.BlackAndWhite = true;
// sheet.PageSetup.PrintGridlines = true;
//sheet.IsGridlinesVisible = false;
//Apply different Image and Print options
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
//options.HorizontalResolution = 300;
//options.VerticalResolution = 300;
// options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionRle;
// options.IsCellAutoFit = true;
options.AllColumnsInOnePagePerSheet = true;
options.OnePagePerSheet = true;
// options.Transparent = true;
// options.OnlyArea = true;
// options.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
options.PrintingPage = PrintingPageType.Default;

SheetRender sr = new SheetRender(sheet, options);
Paragraph para = builder.InsertParagraph();
Aspose.Words.Drawing.Shape shape = new Aspose.Words.Drawing.Shape(doc, ShapeType.Image);

para.ParagraphFormat.SpaceAfterAuto = true;
int pageCount= sr.PageCount;
if (pageCount >= 1)
System.Drawing.Image Image = sr.ToImage(0);
//shape.Height = 650;
//shape.Width = 550;
//shape.ImageData.Borders.Color = System.Drawing.Color.White;
//shape.WrapType = WrapType.None;
//shape.ImageData.Borders.LineStyle = LineStyle.None;
//shape.Stroke.On = false;
//shape.Stroke.Color = System.Drawing.Color.White;
builder.InsertImage(Image, 500, 600);


Hi Mohit,

Thank you for contacting Aspose support.

We have evaluated your presented scenario on our end, and we believe that the Aspose.Cells API is rendering the Gridlines, whereas XPS file format shows only the cell/range borders. You can turn off the Gridlines before rendering the spreadsheet to images while using the Worksheet.IsGridlinesVisible property. Please check the detailed article on this subject, and give another try using the latest version of Aspose.Cells for .NET 8.2.1 in your original application.

In case the problem persists, please provide your sample spreadsheet along with a sample console application replicating the issue. This will help us quickly investigate the problem and log appropriate ticket(s), if required.