نسخ السمة من دفتر العمل الواحد إلى آخر
Contents
[
Hide
]
نسخ السمة من دفتر العمل الواحد إلى آخر
يوضح الكود العيني التالي كيفية نسخ السمة من دفتر عمل واحد إلى دفتر عمل آخر. الكود مفيد لتطبيق سمات مدمجة أو مخصصة. ما عليك سوى إنشاء السمة المرغوبة (يمكن أن تكون سمة مدمجة أو قد تقوم بتخصيصها) في ملف القالب الخاص بك باستخدام Microsoft 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-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u"..\\Data\\TechnicalArticles\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Paths of source and output excel files | |
U16String damaskPath = dirPath + u"DamaskTheme.xlsx"; | |
U16String sampleCopyThemeFromOneWorkbookToAnother = dirPath + u"sampleCopyThemeFromOneWorkbookToAnother.xlsx"; | |
U16String outputCopyThemeFromOneWorkbookToAnother = outPath + u"outputCopyThemeFromOneWorkbookToAnother.xlsx"; | |
//Read excel file that has Damask theme applied on it | |
Workbook damask(damaskPath); | |
//Read your sample excel file | |
Workbook wb(sampleCopyThemeFromOneWorkbookToAnother); | |
//Copy theme from source file | |
wb.CopyTheme(damask); | |
//Save the workbook in xlsx format | |
wb.Save(outputCopyThemeFromOneWorkbookToAnother, SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |