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.AutoFitColumns();
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);
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
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.ImageData.SetImage(Image);
//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;
//para.AppendChild(shape);
builder.InsertImage(Image, 500, 600);
}
}
loopCount++;
}