Hi Aspose Team,
I’m noticing an issue with a symbol not rendering correctly when I convert a chart to image using aspose cells. I’m using the latest version of aspose cells, V25.4.0.
Here’s the code I’ve used:
Document RepDoc = new Document();
DocumentBuilder Builder = new DocumentBuilder(RepDoc);
using (Workbook TemplateWB = new Workbook(dir + @"\Test_04112025_02\Chart_Template.xlsm"))
{
Worksheet sourceWS = TemplateWB.Worksheets["MeasureChartsNew"];
//Set print area
sourceWS.PageSetup.PrintArea = $"B55:M96";
sourceWS.PageSetup.LeftMargin = 0;
sourceWS.PageSetup.RightMargin = 0;
sourceWS.PageSetup.TopMargin = 0;
sourceWS.PageSetup.BottomMargin = 0;
// Clear any header/footer as they'll be captured when converting the worksheet to image
sourceWS.PageSetup.ClearHeaderFooter();
// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions
{
OnePagePerSheet = true,
ImageType = Aspose.Cells.Drawing.ImageType.OfficeCompatibleEmf,
HorizontalResolution = 100,
VerticalResolution = 100,
OnlyArea = true
};
// Take the image of your worksheet
SheetRender Render = new SheetRender(sourceWS, options);
// Create a stream to save the image in
MemoryStream ImgStream = new MemoryStream();
Render.ToImage(0, ImgStream); //Returns an image of the cell range if an accuarate cell range is suppiled
if (ImgStream != MemoryStream.Null)
{
// Insert this image into the place of the old shape.
Shape newOleShape = Builder.InsertImage(ImgStream);
Aspose.Words.PageSetup PS = Builder.CurrentSection.PageSetup;
double PageWidth = PS.PageWidth - PS.LeftMargin - PS.RightMargin;
if (PageWidth < newOleShape.Width)
{
newOleShape.Width = PageWidth;
}
}
}
RepDoc.Save(dir + @"\Test_04112025_02\Word_Template.docx");
Test_04112025_2.zip (2.7 MB)
I’ve highlighted the issue within the word document. You’ll notice that the symbol next to the values are not rendered properly.