Aspose.Cells.Examples.CSharp.Articles.SetPixelFormatRenderedImage.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Instantiate a new Workbook
            // Load an Excel file
            Workbook wb = new Workbook(dataDir + "Book1.xlsx");
            // Instantiate SheetRender object based on the first worksheet
            // Set the ImageOrPrintOptions with desired pixel format (24 bits per pixel) and image format type
            SheetRender sr = new SheetRender(wb.Worksheets[0], new ImageOrPrintOptions { PixelFormat = PixelFormat.Format24bppRgb, ImageFormat = ImageFormat.Tiff });
            // Save the image (first page of the sheet) with the specified options
            sr.ToImage(0, dataDir + "outImage1.out.tiff");
            // ExEnd:1
        }
    }
SetPixelFormatRenderedImage