SheetRender issue

Hi,

We are having an issue with Aspose Cells Version 5.2.2.1. We have a spreadsheet that we are trying to print to a bitmap image. The sheet has a header row where all headers are formatted as centered. When we print the sheet to an image using the code below, two of the headers are shifted to the left in the bitmap. We need an explanation as to why this is happening, and a fix for the problem. I have attached an example of the spreadsheet and an example of the jpg file.

Thanks,

Steve

Aspose.Slides.License lic = new Aspose.Slides.License();

lic.SetLicense("Aspose.Total.Lic");

Aspose.Cells.License cellLic = new Aspose.Cells.License();

cellLic.SetLicense("Aspose.Total.Lic");

Workbook book = new Workbook(@"c:\development\worksheet.xlsx");

Aspose.Cells.Worksheet sheet = book.Worksheets[0];

sheet.PageSetup.PrintArea = "A1:" + "S3";

sheet.PageSetup.Orientation = PageOrientationType.Landscape;

sheet.PageSetup.PaperSize = PaperSizeType.PaperLetter;

sheet.PageSetup.FitToPagesTall = 1;

sheet.PageSetup.FitToPagesWide = 1;

sheet.PageSetup.TopMarginInch = 0;

sheet.PageSetup.BottomMarginInch = 0;

sheet.PageSetup.RightMarginInch = 0;

sheet.PageSetup.LeftMarginInch = 0;

sheet.PageSetup.HeaderMarginInch = 0;

sheet.PageSetup.FooterMarginInch = 0;

sheet.PageSetup.CenterHorizontally = false;

sheet.PageSetup.CenterVertically = false;

sheet.PageSetup.PrintQuality = 300;

Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();

imgOptions.ImageFormat = ImageFormat.Jpeg;

imgOptions.HorizontalResolution = 600;

imgOptions.VerticalResolution = 500;

imgOptions.OnePagePerSheet = true;

imgOptions.IsImageFitToPage = true;

Aspose.Cells.Rendering.SheetRender sheetRenderer = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);

Bitmap bitmap = sheetRenderer.ToImage(0);

bitmap.Save("c:\\development\\ExcelImage.jpg");

bitmap.Dispose();

bitmap = null;

Hi,

Thanks for reporting.

I can reproduce this bug with latest version of Aspose.Cells for .NET 5.2.3.4. I have attached the output image as a reference.

This issue has been logged as CELLSNET-24370.

My management is asking what will be the turn around time on fixing this bug. What is the estimated time it will take to fix?

Thanks,

Steve

Hi Steve,

We will check if we can provide you an eta for the fix. We will get back to you soon.

Thank you.

Hi,

Good news for you,
We have fixed your issue.

Kindly try Aspose.Cells v5.2.2.5.

Thank you.

Hi Amjad,

I am Steve's team mate

We got your fix, and did check the data O/p. The O/p looks better than before, but not exactly what we wanted.

I am not sure about the way Aspose works on this formatting, but the feeling I am getting is, Aspose.Cells add extra width to columns to align to page. After doing so, the cells are losing their formatting.

Cells that are centre formatted are not centring after we go for print preview. the fix you did worked good for the headers that we marked, but if you actually look at the other cells, some date columns are centre formatted, and they loose their formatting. In the latest O/P we got, we see additional column width on the left, and not in the right, as we used to see previously, but data is not exact centre.

This fix, sorted one issue, but gave rise to another issue. So the point we are trying to raise here is;

-> Can you give us a fix, in such a way, that after you try to align columns to fit to page, can you check the format of the cells, if they are centre aligned, can you maintain that formatting.

Your present fix is great, but not perfect, and we are trying to make it perfect.

Thank you,

Regards,

Raghunandan.

Hi Raghunandan,

Well, we did test with your file, we think the output image or pdf file is exactly the same as your source file’s sheet. Well, Aspose.Cells’s feature i.e. Worksheet-to-Image renders images based on the print preview settings in MS Excel. You may see the print preview of the source worksheet in MS Excel, it should be same as the output image or pdf file you get using Aspose.Cells API. If you find different result, please attach your output files (e.g output image file and Pdf file) and point out the areas / sections in the sheet which are not the same as the source, you may encircle the areas/data to better make us understand the issue(s), we can check it soon.

Thank you.

Hi ,

I have attached another spreadsheet and jpg file. We are seeing darker lines every so often in the jpg. Also, it looks like space has been added to the left of the cell to compensate. This causes dates that are right justified to be "scrunched" to the right in the cell.

Hi,

Please encircle the problematic areas with red circles to highlight issues.

I’ve attached a jpg with the darkened line with a red elipse.

Hi,

Thanks, I have updated the issue and marked it as unresolved.

We have noticed that the "thick" border we see may have to do with two cells being rendered as overlapping. This issue, as well as the alignment issue, is causing us to delay a very important production release. Do you all have a tech support number I can call to discuss this issue?

Thanks,

Steve

Could you encircle the areas with alignment issues using red circles?
We will check it soon.

If you look previously in the thread, I uploaded an image with the dark black lines circled. When we output without setting horizontal and vertical resolution, we notice the double black lines I noted above. When we output with 500 horizontal resolution and 600 vertical resolution, we get better output, but this makes our powerpoint presentations quite large in size. This is not acceptable to our solution. Do you have a technical support line I can call during US hours?

Thanks,

Steve

Hi Steve,

Fisher is asking you to highlight alignment issue.

I have also highlighted your thick border issue, where red circle was not quite visible. We will fix it as soon as possible and let you know.

I have attached two jpgs highlighting the alignment issue. The following two issues:

1. dark border

2. Alignment

Are preventing us from releasing our product to production. We need a fix as soon as possible to prevent production delays.

Thanks,

Steve

Hi,

Please also attach their source xls/xlsx files.

Hi,

Please try Aspose.Cells for .NET 5.2.2.6.

We have enhanced the Center Alignment
in SheetRender.

For the “Dark line” issue:

We have made a test using
following code:



string fullPath = @“Z:\worksheet.xlsx”;

Workbook book = new Workbook(fullPath);

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();

imgOptions.ImageFormat = ImageFormat.Jpeg;

imgOptions.HorizontalResolution = 96;

imgOptions.VerticalResolution = 96;

foreach(Worksheet sheet in book.Worksheets)

{

SheetRender sr = new SheetRender(sheet, imgOptions); // System.IO.EndOfStreamException

for (int j = 0; j < sr.PageCount; j++)

sr.ToImage(j, @“Z:\output” + sheet.Index + “_”+j+".Jpeg");

}

If we open the
attachment in Microsoft Picture Viewer at picture’s actual size, every line is looked the
same. If we enlarge the view to some scale like 150%, the dark lines appear. So
we think it’s not a issue in Aspose.Cells. It looks like the rendering strategy
of the picture viewer.

Version 5.2.2.6 does correct the center alignment, but now test that is left aligned is butting up against the left border. We also see a dark border on certain cells. I have attached a sample excel file and a jpg highlighting the issues. We are still in danger of missing a production release due to these issues.

Thanks for your support,

Steve

Hi Steve,

Thanks for reporting. We will update you as soon as possible.