Excel Çalışma Sayfasının Saydam Görüntüsünü Oluşturun
Contents
[
Hide
]
Bazen, çalışma sayfanızın görüntüsünü şeffaf bir görüntü olarak oluşturmanız gerekir. Dolgu renkleri olmayan tüm hücrelere saydamlık uygulamak istiyorsunuz. Aspose.Cells şunları sağlar:ImageOrPrintOptions.Şeffafçalışma sayfası görüntüsüne saydamlık uygulama özelliği. Bu özellik ne zamanYANLIŞ , daha sonra dolgu renkleri olmayan hücreler beyaz renkle çizilir vedoğru, dolgu renkleri olmayan hücreler saydam olarak çizilir.
Aşağıdaki çalışma sayfası görüntüsünde saydamlık uygulanmamıştır. Dolgu renkleri olmayan hücreler beyaz olarak çizilir.
Şeffaflık olmadan çıktı: hücre arka planı beyazdır |
---|
![]() |
Aşağıdaki çalışma sayfası görüntüsünde ise şeffaflık uygulanmıştır. Dolgu rengi olmayan hücreler şeffaftır.
Şeffaflık etkinleştirilmiş çıktı |
---|
![]() |
Aşağıdaki örnek kod, bir Excel çalışma sayfasından saydam bir görüntü oluşturur.
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-.NET | |
//Source directory | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
//Output directory | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Create workbook object from source file | |
Workbook wb = new Workbook(sourceDir + "sampleCreateTransparentImage.xlsx"); | |
// Apply different image or print options | |
var imgOption = new ImageOrPrintOptions(); | |
imgOption.ImageType = Drawing.ImageType.Png; | |
imgOption.HorizontalResolution = 200; | |
imgOption.VerticalResolution = 200; | |
imgOption.OnePagePerSheet = true; | |
// Apply transparency to the output image | |
imgOption.Transparent = true; | |
// Create image after apply image or print options | |
var sr = new SheetRender(wb.Worksheets[0], imgOption); | |
sr.ToImage(0, outputDir + "outputCreateTransparentImage.png"); |