Hi, I’ve encountered a strange behavior when transforming donut chart in image.
I’ve noticed that some label are truncated if the text is longer more than 10 caracter and without space.
Here’s my code:
string pathExcelFile = pathAppDataDir + “ExcelFile.xlsx”;
string sheetName = “chartSheet”;
string chartName = “chart”;
string pathImageFile = pathAppDataDir + “ImageFile.png”;
string pathWordFile = pathAppDataDir + “WordFile.docx”;
if (File.Exists(pathExcelFile))
{
Workbook workbook = new Workbook(pathExcelFile);
Worksheet worksheet = workbook.Worksheets[sheetName];
Chart chart = worksheet.Charts[chartName];
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageType = Aspose.Cells.Drawing.ImageType.Png;
options.VerticalResolution = 300;
options.HorizontalResolution = 300;
options.Quality = 100;
if (File.Exists(pathImageFile))
{
File.Delete(pathImageFile);
}
chart.ToImage(pathImageFile, options);
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Image image = Image.FromFile(pathImageFile);
builder.InsertImage(image);
if (File.Exists(pathWordFile))
{
File.Delete(pathWordFile);
}
doc.Save(pathWordFile);
}
Here’s the file I used: ExampleFile.zip (66.7 KB)
Looking at the image generated you’ll notice that the label that in excel is “International” in the image became “nal”, and also “Asia/Australia” became “alia”.
Please, can you help me?