تنسيق القطاعة
Contents
[
Hide
]
تنسيق القطاعة
باستخدام Microsoft Excel ، يمكنك تنسيق أداة تقطيع الشرائح عن طريق تعيين عدد الأعمدة والأنماط الخاصة بها ، وما إلى ذلك. يوفر Aspose.Cells for Python via Java خصائص Slicer.NumberOfColumns و Slicer.StyleType لتحقيق ذلك.
يقوم مقتطف الشفرة التالي بتحميل ملفنموذج لملف Excelالذي يحتوي على قطاعة. يصل إلى أداة التقطيع ويحدد عدد الأعمدة ونوع النمط ويحفظه كـإخراج ملف 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
import jpype | |
import asposecells | |
jpype.startJVM() | |
from asposecells.api import Workbook, SaveFormat, SlicerStyleType | |
# Load Source Excel file | |
workbook = Workbook("sampleFormattingSlicer.xlsx") | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Access the newly added slicer from slicer collection | |
slicer = worksheet.getSlicers().get(0) | |
# Set the number of columns of the slicer | |
slicer.setNumberOfColumns(2) | |
# Set the type of slicer style | |
slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_6) | |
# Save the workbook in output XLSX format | |
workbook.save("outputFormattingSlicer.xlsx", SaveFormat.XLSX) | |
jpype.shutdownJVM() |