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

Free Support Forum - aspose.com

Border thickness isn't kept

Hello,


Using a web application I’m trying to save a range as an image.
The problem is that the thickness of the bottom cell border isn’t kept although the value for the ImageOrPrintOprins.OnlyArea is set to false.
I’m using the following code:
protected void Page_Load(object sender, EventArgs e)
{
var asposeCellsLicense = new License();
asposeCellsLicense.SetLicense("…\Aspose\Aspose.Cells.lic");
var xls1 = new Workbook(“C:\tstFile.xlsx”);
for (int i = 0; i < xls1.Worksheets.Count; i++)
{
xls1.Worksheets[i].Shapes.UpdateSelectedValue();
}

var opt = new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = false
};

xls1.Worksheets[“Sheet1”].PageSetup.PrintArea = “B2:B4”;

var sh1 = new SheetRender(xls1.Worksheets[“Sheet1”], opt);
var image = sh1.ToImage(0);
image.Save(“C:\out_1.png”);
}

Thank you,
George Radu
IBM Romania

Hi George,


Thank you for contacting Aspose support.

Could you please also share the input spreadsheet tstFile.xlsx as well as the resultant PNG image for investigation?

Hello,


Sorry about that. I’ve attached the xlsx document.

Best regards,
George Radu
IBM Romania
--------

Internal ID : 13024


Hi George,


Thank you for sharing the samples.

I believe you are already aware that the borders are being shared between the consecutive cells, that is; the border below the cell B4 is also the part of B5. When you specify a print area that passes through the consecutive cells (sharing the common border) then the border is split into half. Consequently only the potion that is insider the print area is rendered. That is the reason the thickness of border below the cell B4 is less than the border below the cell B2, because it is being split due to the specified print area (B2:B4). If you add another row to the print area (B2:B5) the result will be fine.

Regarding the ImageOrPrintOptions.PrintArea property, it is generally used with ImageOrPrintOptions.OnePagePerSheet property. When OnlyArea is set to true, the API will ignore the margins and try to render only the print area. Moreover, the print area specified in Worksheet’s PageSetup will still take effect regardless of the OnlyArea value.

I have attached a few images with this post for your reference. Hope the above justification helps in understanding this scenario.

Hi,


The thing is that I can’t extend the PrintArea with one more row. Isn’t OnlyArea property supposed to allow printing of borders that extend into the other cell outside the PrintArea?
And also, in a previous post you said something about the saving of the selected print area in pdf format. If you do this by selecting B2:B4, you will see that the borders have the same thickness(I’ve attached the resulting pdf document).

Thank you,
George Radu
IBM Romania

Hi George,


Thank you for writing back.

As per my understanding, setting the OnlyArea property to true does the following, however, it isn’t suppose to extend the print area by any means.

  • Ignores the margins.
  • Ignores the page breaks.

Regarding the spreadsheet to PDF conversion (with Excel application) while specifying the range B2:B4, I can confirm that the border thickness is the same. If you could allow me some time, I can further discuss this matter with the concerned member of the product team and bring back some updates in this regard.
Hi again,

This is to update you that I have discussed this matter with the concerned member of the product team, and have logged a ticket as CELLSNET-44407 in order to enhance the API to handle rendering situations where specified print area passes through the cells sharing the borders. We need some time for the feasibility analysis of this scenario. As soon as we have completed the preliminary analysis, we will post the results here for your reference.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.8.0.3 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-44407) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,


This was fixed in a previous version, but in the current version this is still reproducing.

Thank you,
George Radu
IBM Romania

Hi,

Thanks for your posting and using Aspose.Cells.

I have tested this issue with the following sample code with older and latest version: Aspose.Cells for .NET v8.9.0.5 and both output images look same. I have attached them for your reference.

C#
var xls1 = new Workbook(“tstFile.xlsx”);
for (int i = 0; i < xls1.Worksheets.Count; i++)
{
xls1.Worksheets[i].Shapes.UpdateSelectedValue();
}

var opt = new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = false
};

xls1.Worksheets[“Sheet1”].PageSetup.PrintArea = “B2:B4”;

var sh1 = new SheetRender(xls1.Worksheets[“Sheet1”], opt);
var image = sh1.ToImage(0);
image.Save(CellsHelper.GetVersion() + “-out.png”);

Hello,


This issue is reproducing in the 16.10.0.0 version of Aspose Cells.

Thank you,
George Radu

Hi,


Thanks for your posting and using Aspose.Cells.

It is working fine in latest version: Aspose.Cells for .NET v16.11.8. Please check the output image for your reference.

Please note, we have also tested this issue with older version mentioned by you, both output images are attached for your reference.