Unable to convert entire workbook into gif

Hi Team,

I tried converting an .xslx file having 2 worksheets in to gif. But I can see only 1st sheet coming as part of output gif. Added the code snippet as well as the files below.

Is it possible to have the entire workbook(all worksheets inside it) to gif?

    static void ExcelToGifConversion()
    {
        var workbookStream = new FileStream("test.xlsx", FileMode.Open);
        var workbook = new Workbook(workbookStream);
        workbook.Save("test.gif");
    }

test.zip (11.0 KB)

Thanks

@dfactset
By using sample files and code for testing, we can reproduce the issue. Found that only the data from the first worksheet was saved to the result file when converting the file to GIF format.

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-54678

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.

@dfactset

For image formats such as gif, png, …etc., it is hard to manage multiple sheets/pages of the rendered results. So, please use apis in WorkbookRender or SheetRender such as ToImage(int, string) to convert the workbook to images with more flexible options. And the document for your reference: Image|Documentation (aspose.com)

@dfactset ,

As @johnson.shi decribed, you can use WorkbookRender.ToImage(string filename) to directly save workbook to a single Tiff image with multi frames/pages.

However, if you want to save workbook to a single Gif with multi frames, you can use WorkbookRender.ToImage(int pageIndex, string fileName) to save workbook to separated images(e.g. png), then add all the images to Gif image by your own code with more options(e.g. frames delay, repeat).

@johnson.shi
I tried the WorkbookRender.ToImage() but still couldn’t convert entire workbook to gif. The gif output says “we don’t support this format”.

    static void ExcelToGifConversion()
    {
        var workbookStream = new FileStream("test.xlsx", FileMode.Open);
        var workbook = new Workbook(workbookStream);
        var options = new ImageOrPrintOptions
        {
            ImageType = ImageType.Gif
        };
        var workbookRender = new WorkbookRender(workbook, options);
        workbookRender.ToImage("test.gif");
    }

test.zip (47.8 KB)

@peyton.xu
Does this mean there is no way to create the gif directly from excel workbook? we have to create pngs first for each worksheet and then we have to stitch them together to create gif?

@dfactset
Your understanding is correct. Currently, Aspose.Cells does not support creating gif files directly from Workbook. As an alternative, you can first create pngs for each worksheet and then stitch them together to create a gif file according to specific requirements, such as using Aspose.Imaging to complete the stitching operation. Sorry for any inconvenience caused to you.