تصدير نطاق منطقة الطباعة إلى HTML
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
هذا سيناريو شائع حيث نحتاج إلى تصدير منطقة الطباعة فقط ، أي نطاق الخلايا المحدد بدلاً من الورقة بأكملها إلى HTML. هذه الميزة متاحة بالفعل لتقديم PDF ، ومع ذلك ، يمكنك الآن تنفيذ هذه المهمة لـ HTML أيضًا. قم أولاً بتعيين منطقة الطباعة في كائن إعداد الصفحة لورقة العمل. في وقت لاحق ، استخدمHtmlSaveOptions.ExportPrintAreaOnly علم لتصدير النطاق المحدد فقط.
عينة من الرموز
يؤدي نموذج التعليمات البرمجية التالي إلى تحميل مصنف ثم تصدير منطقة الطباعة إلى HTML. يمكن تنزيل نموذج ملف لاختبار هذه الميزة من الارتباط التالي:
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 | |
// Load the Excel file. | |
Workbook wb = new Workbook(sourceDir + "sampleInlineCharts.xlsx"); | |
// Access the sheet | |
Worksheet ws = wb.Worksheets[0]; | |
// Set the print area. | |
ws.PageSetup.PrintArea = "D2:M20"; | |
// Initialize HtmlSaveOptions | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
// Set flag to export print area only | |
options.ExportPrintAreaOnly = true; | |
//Save to HTML format | |
wb.Save(outputDir + "outputInlineCharts.html", options); |