Cells to Slides issues

Using this code I am losing some of the formatting from the worksheet range:

    private void ExportToPowerPoint()
    {
        string excelFilePath = @"C:\Users\Kipp\Desktop\Presentations\GridToSlideTest.xlsx";

        Workbook asposeWorkbook;

        LoadOptions options = new LoadOptions() { CultureInfo = CultureInfo.CurrentCulture };

        asposeWorkbook = new Workbook(excelFilePath, options);

        string pptPath = Path.Combine(Path.GetDirectoryName(excelFilePath) ?? string.Empty, "GridToSlideTest.pptx");

        Presentation presentation;
        using (MemoryStream stream = new())
        {
                asposeWorkbook.Save(stream, SaveFormat.Pptx);

                presentation = new Presentation(stream);
        }

        presentation.Save(pptPath, Aspose.Slides.Export.SaveFormat.Pptx);
    }

Worksheet:
image.png (45.8 KB)

Slide:
image.png (64.3 KB)

@kippow
Would you like to provide your sample file? The sample file is very helpful for us to locate the issue. We will check it soon.

GridToSlideTest.zip (9.8 KB)

Here you go!

@kippow,

Thanks for the template XLSX file.

After an initial testing, I am able to reproduce the issue you mentioned by simply converting your template XLSX file to PPTX via Aspose.Cells. I found issue(s) with some borders and formatting in Excel spreadsheet to PPTX rendering.

string excelFilePath = "g:\\test2\\GridToSlideTest.xlsx";
Workbook asposeWorkbook;
LoadOptions options = new LoadOptions();
asposeWorkbook = new Workbook(excelFilePath, options);
asposeWorkbook.Save("g:\\test2\\out1.pptx", SaveFormat.Pptx);

We require thorough evaluation of your issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-54742

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.

@kippow

  1. PowerPoint does not support a double line style for table borders. We will export it as a thin line later.
  2. Row height is lost. It seems to be a limitation of PowerPoint. If the row height is less than the limitation, it does not work.

This is great info. Thanks.

FYI, regarding the row height, I did some playing with it an found that the minimum height is determined by the row’s font size. The row height can be made smaller by choosing a smaller font. That’s a good workaround to be aware of.

@kippow
Sure, if you have more questions, we can discuss them here.

@kippow

We found that all the fonts in the cells of the row must be changed so that the row height can become small. However, if we change the font of the cells to adjust the row height, the font settings will be lost. Is it fine for you?

If there is no text in the row then adjusting the font size wouldn’t cause any problem for me.

@kippow,

Alright, thanks for clarifying and providing further details.

@kippow

Do you mean that we only need to adjust font size for blank rows?
If this row contains data, do we still need to adjust the row height?

Yes. I think if the row contains visible text at all then the row size should be set as it currently is being done by Aspose Cells. If the worksheet has a row with a height that is set too short for the font then that’s an issue that should be adjusted in the worksheet.

In other words, I would only change the font size in Aspose Cells to reduce the row height in the case where the row has no visible content.

@kippow
Thank you for the clarification. We will evaluate it and share feedback soon.

@kippow
In the coming release version 23.12, we only supported adjust font size for empy rows as the following codes:

PptxSaveOptions saveOptions = new PptxSaveOptions();
saveOptions.IgnoreHiddenRows = true;
saveOptions.AdjustFontSizeForRowType = Aspose.Cells.Slides.AdjustFontSizeForRowType.EmptyRows;
wb.Save(Constants.destPath + "CELLSNET54742.pptx", saveOptions);

If you want to auto fit row height if row contains data, please auto fit row height now.
But this feature will also reduce row height if it’s too large. We will check whether we only auto fit row height for the rows which can not show all data.

The issues you have found earlier (filed as CELLSNET-54742) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

Thanks. I’ll give it a try.

@kippow,

You’re welcome. Please take your time to try the new version. Hopefully, with the suggested code segments and other instructions, the new version will work for your needs.