قم بإنشاء صورة شفافة لورقة عمل Excel
Contents
[
Hide
]
في بعض الأحيان ، تحتاج إلى إنشاء صورة ورقة العمل الخاصة بك كصورة شفافة. تريد تطبيق الشفافية على جميع الخلايا التي لا تحتوي على ألوان تعبئة. يوفر Aspose.Cells ملفخيارات ImageOrPrint. شفافلتطبيق الشفافية على صورة ورقة العمل. عندما تكون هذه الخاصيةخاطئة ، ثم يتم رسم الخلايا التي لا تحتوي على ألوان تعبئة باللون الأبيض وعندما يتم ذلكحقيقي، يتم رسم الخلايا التي لا تحتوي على ألوان تعبئة شفافة.
في صورة ورقة العمل التالية ، لم يتم تطبيق الشفافية. يتم رسم الخلايا التي لا تحتوي على ألوان تعبئة باللون الأبيض.
الإخراج بدون شفافية: خلفية الخلية بيضاء |
---|
![]() |
بينما ، في صورة ورقة العمل التالية ، تم تطبيق الشفافية. الخلايا التي لا تحتوي على ألوان تعبئة شفافة.
الإخراج مع تمكين الشفافية |
---|
![]() |
يُنشئ نموذج التعليمات البرمجية التالي صورة شفافة من ورقة عمل Excel.
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"); |