Document RepDoc = new Document();
DocumentBuilder Builder = new DocumentBuilder(RepDoc);
using (Workbook TemplateWB = new Workbook(dir + @"\Test_04072025\Excel_Template.xlsm"))
{
Worksheet sourceWS = TemplateWB.Worksheets["Q038_STND_1"];
//Set print area
sourceWS.PageSetup.PrintArea = $"P51:AK102";
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_04072025\Word_Template.docx");
I have highlighted the issues in red in the word document named “Word_Template.docm”
Issue #1 - The shapes in the graph plotting seems to lower resolution when compared to its legends to the right of the graph. Column “Markers” next to the graph shows the legends. This is highlighted in green in the word document.
Issue #2 - The shapes that overlap with the x-axis and y-axis are somehow behind the axis. Where as if you look at excel equivalent, you’ll notice that the shape seems to be in front of the axis. These are highlighted in red in the word document.
Issue #3 - Some shapes under the column “Marker” have an underline/bottom border. Not sure how this is happening. But the excel equivalent doesn’t have this. These are highlighted in orange in the word document.
We will try to provide the screenshot generated by the new fix for your reference. And for the newly reported issues, we will look into them too.
However, because there are too many irrelevant topics and issues in this thread, it becomes more and more difficult to discuss them separately and track the status of those tickets. We believe it would be much better if you could record every new issue in a new post so we can discuss them separately and clearly.
I simply inserted the output image shared by @simon.zhao into a MS Word (new) document manually and noticed the issue you have highlighted. We will evaluate the issue thoroughly and get back to you soon.
Yes, we already reproduced all three issues and replied in your other thread. Please see and follow up your other thread for replies and for your reference.
Hi @JThomas98
For CELLSNET-57940 ( Horizontal and vertical labels are garbled), we have fixed it, the result is as follows, it will take effect in 25.4. CELLSNET-57940-fix.png (57.3 KB)
For CELLSNET-57941 ( Certain plottings in each quadrant is pointing the wrong way), we have conducted research and optimization, and the results are shown in the figure below: CELLSNET-57941-fix1.png (28.0 KB) CELLSNET-57941-fix2.png (57.1 KB)
We find that Excel will only describe a “dialog box with an arrow” but will not describe the direction of the arrow.
As shown in the screenshot, the direction of the arrow may be different in your Excel and my Excel, which may be related to the Excel version (Because it does not stipulate the direction of the arrow, different effects are also presented in Excel of different machines).
We have optimized as much as possible based on your Excel screenshot, and there is also an explanation in the screenshot. You can observe after using the 25.4 version, and if there are any problems, you can feedback again.
If you look at the words in the vertical label, specifically the word “Lower”, you can notice the font kerning is different from letter to letter. The same with the word “Rates”, e & s seem closer than the rest of the letters in the word.
Another thing that I’ve highlighted is the irrelevant plotting that I’ve circled. Not sure from where that has come.
Hi @JThomas98
The irrelevant plotting does not exist in the original image I output: MyOut1.zip (15.8 KB)
I think it should be that I accidentally added it when cutting and editing the picture, sorry about this.
About the font kerning, I think I understand what you mean, we record it as CELLSNET-58180, we will investigate it more.
The issues you have found earlier (filed as CELLSNET-57840,CELLSNET-57841,CELLSNET-57938,CELLSNET-57940,CELLSNET-57941,CELLSNET-58128,CELLSNET-58131) have been fixed in this update. This message was posted using Bugs notification tool by leoluo
Hi @JThomas98
For CELLSNET-57953 ( The discrepancy in the spacing between the text and the arrow between image and Excel), we have optimized it, the results are shown in the figure below, it will take effect in version 25.5. CELLSNET-57953-fix.png (23.3 KB)
CELLSNET-58094 - Underlines are breaking in texts or titles when rendering sheet to image
We are pleased to inform you that your issue has been resolved. The fix/enhancement will be included in an upcoming release (Aspose.Cells v25.5) that we plan to release in the first half of May 2025. You will be notified when the next version is released.
Thanks for your confirmation on the issue (Ticket ID: “CELLSNET-58094”). We will make sure that you get notification post on new version (Aspose.Cells v25.5) once it is available next month.
Moreover, we are glad that using TextRenderingHint = TextRenderingHint.AntiAlias in ImageOrPrintOptions class works for your needs for font kerning issue (Ticket ID: “CELLSNET-58093”).
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.