@Adhirath
Please refer to the following example code for creating and traversing ranges. You can obtain a specific range by determining the starting row and column when traversing the ranges.
const AsposeCells = require("aspose.cells.node");
// Create the workbook
const workbook = new AsposeCells.Workbook();
// Get the first worksheet in the worksheets collection.
const worksheet = workbook.getWorksheets().get(0);
const cells = worksheet.getCells();
// Create a range of cells.
const range1 = cells.createRange("A1", "A2");
const range2 = cells.createRange("C1", "C2");
const range3 = cells.createRange("E1", "E2");
const ranges = cells.getRanges();
ranges.add(range1);
ranges.add(range2);
ranges.add(range3);
const rangeCount =ranges.getCount();
console.log(rangeCount);
for (let i = 0; i < rangeCount; i++) {
const range = ranges.get(i);
console.log(range.getAddress() + "start row: " + range.getFirstRow() + " start column: " + range.getFirstColumn());
}
Hi Guys, facing an issue with Emf ImageType. I am using the following code -
worksheet.AutoFitRows();
worksheet.PageSetup.PrintArea = printArea;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
if i look closely i can see small differences, the border lines for the last 2 rows are thicker, there is also an extra border wrapped around the table. The same issue happens with my chart as well, it ends up having font issues, look at ChartTitle in the below picture having no space in between etc. image.png (15.2 KB)
my code for chart is straight forward-
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions()
{
ImageType = ImageType.Emf,
};
using (MemoryStream ms = new MemoryStream())
{
if (isChart)
{
((Aspose.Cells.Charts.Chart)chartOrShape).ToImage(ms, imgOptions);
}
else
{
((Aspose.Cells.Drawing.Shape)chartOrShape).ToImage(ms, imgOptions);
}
return ms.ToArray();
}
You can try out the same with the below excel file- Book_1742996484.zip (1.3 MB)
@Adhirath
We have opened the following new ticket(s) for the border issues in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-58194
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@Adhirath
Setting the same higher horizontal and vertical resolution will result in larger pixels in the width and height of the image, while maintaining the same aspect ratio The physical size of the image (in unit of points) remains unchanged
@Adhirath
You are welcome. Please take your time to try the suggested solutions. Hopefully, your issue will be sorted out. Please let us know your feedback.
Emf image is vector image, the line may be variable if zoom is different. Please check the attchement word document comparing Aspose generated Emf image and Excel Copied “As shown when printed” image. EmfComparing.docx (21.4 KB)
Hi guys, i am facing another issue-
I am using aspose cells to take an image of a range, the image is not looking like the excel range exactly, it varies in column width, row width, overall image size etc. the code i use to get the range image is the following-
byte[]? originalImage = null;
@Adhirath
Would you like to provide a runnable test code? If we could provide screenshots and highlight the error location, it would be very helpful for us to locate the issues. We will check it soon.
There are two options when you “Copy as Picture” in Excel: “As shown on screen” and “As shown when printed”. Excel_Copy_Picture.png (146.9 KB)
The image generated by the code you shared is close to the one by copying “As shown when printed” in Excel.
If you want the generated image to be close to the one by copying “As shown on screen” in Excel, please enable ImageOrPrintOptions.OnlyArea option.
Hi John, sorry this is as much code as I can share but it has all the logic for getting the image. I have provided the screenshots and also the source documents to show the difference. Let me know what will help you understand it better
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.