We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong border style when converting worksheet into image

Hi, we are saving a worksheet as image with the following code:

var wb = new Workbook("Example.xlsx");
var worksheet = wb.Worksheets[0];
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
worksheet.PageSetup.TopMargin = 0;

var options = new ImageOrPrintOptions
    OnePagePerSheet = true,
    ImageType = Aspose.Cells.Drawing.ImageType.Png,
    VerticalResolution = 600,
    HorizontalResolution = 600,
    Quality = 100
var sr = new SheetRender(worksheet, options);
var ms = new MemoryStream();
sr.ToImage(0, ms);
File.WriteAllBytes("Example.png", ms.GetBuffer());

But we have encountered the following issue: in the attached spreadsheet we have a table with dotted borders, but in the rendered image the borders are continuous.

Is there a way to solve this issue and have the right borders?

Example.zip (21.2 KB)

We have reproduced this issue and logged it in our database for an investigation and fix. You will be notified here once any feedback is ready to share.

CELLSNET-47502 - Wrong border style when converting worksheet into image


We evaluated your issue further. We found it is not an issue with the APIs. If you save the source file to PDF manually by Microsoft Excel “Save as”, you will also find that the border is solid line (see attachment: “Example_Ms.pdf” for your reference).
Example_Ms.pdf (190.8 KB)

We do not want to have a PDF, but an image.

If you manually copy and paste as Image the range in MS Excel, you can see the dotted borders.
This is our expected result.

We have noted your concerns and will evaluate this issue further.

We render the file to image as printed. Something like “Copy” -> “Copy as Picture” -> “As shown when printed”.(see screenshot: “copy_picture_as_printed.png”).

You can change the border style to Dotted as shown in the file “Example-dotBorder.xlsx”, to get dotted border lines in the output image.

dotBorder.zip (52.1 KB)