Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells can now render a worksheet to a graphic context. The graphic context can be anything such as an image file, a screen, or a printer. Please use one of the following two methods to render a worksheet to a graphic context.
The following code illustrates how to use Aspose.Cells to render a worksheet to a graphic context. Once you execute the code, it will render the entire worksheet, fill the remaining empty space with a blue color in the graphics context, and save the image as the OutputImage_out.png file. You can use any source Excel file to try this code. Please also read the comments inside the code for better understanding.
#include <iostream>
#include <memory>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Rendering;
int main()
{
Aspose::Cells::Startup();
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
Workbook workbook(srcDir + u"SampleBook.xlsx");
Worksheet worksheet = workbook.GetWorksheets().Get(0);
ImageOrPrintOptions opts;
opts.SetOnePagePerSheet(true);
opts.SetImageType(ImageType::Png);
SheetRender sr(worksheet, opts);
sr.ToImage(0, outDir + u"OutputImage_out.png");
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.