Hi,
We are using Aspose.PDF version 21.11.0 to convert excel files to PDF. The settings for the excel worksheet are shown below in screenshot1. When this excel worksheet gets converted to PDF, the graph seems to be left-aligned and adds additional whitespace onto the right which looks like screenshot 2 below.
printsettings.PNG (113.2 KB)
image.png (42.3 KB)
Here’s the code used to convert an excel document to PDF -
if (fileExtension.ToLower().Contains(".xls"))
{
//Convert Excel doc to PDF
var workbook = new Aspose.Cells.Workbook(mStream);
foreach (Aspose.Cells.Worksheet sheet in workbook.Worksheets.Where(worksheet => !worksheet.Name.StartsWith(“sheet_”)))
{
sheet.IsVisible = false;
}
if (workbook.Worksheets.Any())
{
var pdfStream = new MemoryStream();
workbook.Save(pdfStream, Aspose.Cells.SaveFormat.Pdf);
BlobContainerClient container = new BlobContainerClient(_settings.CloudStorageConnection, “containername”);
BlobClient blob = container.GetBlobClient($"/converted/{newFilePath}");
pdfStream.Position = 0;
blob.Upload(pdfStream, true);
pdfStream.Close();
}
}
We are not specifying any formatting explicitly using Aspose.
I want to make sure that the graph looks exactly the same in Excel’s print preview format without any whitespace. How can I accomplish this? Any help is greatly appreciated. Thank you in advance.
Regards
SLS