// Create workbook object from source file
Workbook workbook = new Workbook("sampleExcel.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.Worksheets;
// Access first chart inside the worksheet
Aspose.Cells.Charts.Chart chart = worksheet.Charts;
// Set image or print options
Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
opts.SaveFormat = SaveFormat.SVG;
// Save the chart to svg format
Actually the reason we want the VML is because we want to embed the pictures in outlook email. Simply export the worksheet to html and set the MailMessage.HtmlBody has layout issues as outlook doesn’t support the css “positon”, our purpose is not to export the charts but to turn the whole worksheet including tables, charts, into Email body in Html.
As far as I know, storing the images in VML format inside html can solve the layout issue. That’s why I want to convert the charts into VML.
Your issue seems to be more related to Aspose.Email because Aspose.Email converts the HTML to Email format or Outlook format. Please post your issue in Aspose.Email Forum for more clarifications.
Aspose.Cells only converts the Excel to HTML. It is a generic thing while your requirement is specific to you. Mostly, we add new features when they are not difficult to add or if they are complex and many users want this.
Also, what I understood, you don’t need VML format, you only want the solution of your problem or any workaround that could solve your issue.
Regarding VML format, I researched it and found it is already outdated.
You can consider these options with Aspose.Cells.
Convert your Excel file into Pdf and send it as attachment to your clients.
Convert your Entire worksheet into Image(s) and create HTML which will only have images and send it to your client as an embedded HTML (containing images)
Convert each of your worksheet into a separate HTML (i.e. HtmlSaveOptions.ExportActiveWorksheetOnly) and then work with them or combine them as per your needs. You will also have the option to embed images inline using HtmlSaveOptions.ExportImagesAsBase64 property.
Right, that’s what I’m thinking, to render the entire worksheet to images and put it in html.
Put excel, pdf or individual html file as attachment in email is not what we need.
Thanks a lot for the help, I think all these are helpful for me knowing better on Aspose. I think 2nd approach is our only choice for now and meanwhile I probably can raise a request to export charts as VML/OpenXML and see if it is easy for you, hopefully it is
BTW, I think it’s more related to Aspose.Cells instead of Aspose.Email because:
The problem that I have was caused by the Outlook does (actually many other email clients do) not support some css, like “position”, which makes the layout in outlook really bad.
For Microsoft, their solution in Excel (and word, …) is to export the chart in both VML/OpenXml and Html img element and let the client (email client, browser) decides which one to use by checking if it supports vml.
So it’s more like add a VML format to the Aspose.Cells.Rendering.ImageOrPrintOptions.
Regarding this problem, I find out a walkaround.
All I need is to have the pictures/charts cover across the columns/rows, as some css doesn’t work in outlook, I can achieve that by merge the cells and that works.
We are afraid, we will not work on this issue (i.e. CELLSNET-45455) because of its complexity and because you have also found the workaround for your problem. Thanks for your understanding and have a good day.