ImageOrPrintOptions'ın PageIndex ve PageCount Özelliklerini Kullanarak Sayfa Sırasını Oluşturun
Contents
[
Hide
]
Olası Kullanım Senaryoları
Aspose.Cells ile Excel dosyanızın bir dizi sayfasını görüntülere dönüştürebilirsiniz.ImageOrPrintOptions.PageIndexveImageOrPrintOptions.PageCountözellikler. Bu özellikler, çalışma sayfanızda çok fazla örneğin binlerce sayfa olduğunda, ancak bunlardan yalnızca bazılarını işlemek istediğinizde kullanışlıdır. Bu sadece işlem süresinden tasarruf etmekle kalmayacak, aynı zamanda işleme sürecinin bellek tüketiminden de tasarruf sağlayacaktır.
ImageOrPrintOptions’ın PageIndex ve PageCount Özelliklerini Kullanarak Sayfa Sırasını Oluşturun
Aşağıdaki örnek kod,örnek excel dosyasıkullanarak yalnızca 4, 5, 6 ve 7. sayfaları işler.ImageOrPrintOptions.PageIndexveImageOrPrintOptions.PageCountözellikler. İşte kod tarafından oluşturulan işlenmiş sayfalar.
![]() |
![]() |
---|---|
![]() |
![]() |
Basit kod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample Excel file | |
Workbook wb = new Workbook(srcDir + "sampleImageOrPrintOptions_PageIndexPageCount.xlsx"); | |
//Access the first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Specify image or print options | |
//We want to print pages 4, 5, 6, 7 | |
ImageOrPrintOptions opts = new ImageOrPrintOptions(); | |
opts.setPageIndex(3); | |
opts.setPageCount(4); | |
opts.setImageType(ImageType.PNG); | |
//Create sheet render object | |
SheetRender sr = new SheetRender(ws, opts); | |
//Print all the pages as images | |
for (int i = opts.getPageIndex(); i < sr.getPageCount(); i++) | |
{ | |
sr.toImage(i, outDir + "outputImage-" + (i+1) + ".png"); | |
} |