تحويل النص إلى أعمدة
Contents
[
Hide
]
تحويل النص إلى أعمدة
يمكنك تحويل النص الخاص بك إلى أعمدة باستخدام Microsoft Excel. هذه الميزة متاحة منأدوات البياناتتحتبياناتالتبويب. لتقسيم محتويات عمود إلى عدة أعمدة ، يجب أن تحتوي البيانات على محدد معين مثل الفاصلة (أو أي حرف آخر) بناءً على Microsoft يقوم Excel بتقسيم محتويات خلية إلى خلايا متعددة. يوفر Aspose.Cells أيضًا هذه الميزة عبرTextToColumns طريقة. يوضح مقتطف الشفرة التالي استخدام ملفTextToColumns عن طريق تحويل النص إلى أعمدة بمسافة كمحدد.
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
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Create Workbook | |
workbook = Workbook() | |
# Access the first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Add people name in column A. Fast name and Last name are separated by space. | |
worksheet.getCells().get("A1").putValue("John Teal") | |
worksheet.getCells().get("A2").putValue("Peter Graham") | |
worksheet.getCells().get("A3").putValue("Brady Cortez") | |
worksheet.getCells().get("A4").putValue("Mack Nick") | |
worksheet.getCells().get("A5").putValue("Hsu Lee") | |
# Create text load options with space as separator. | |
txtLoadOptions = TxtLoadOptions() | |
txtLoadOptions.setSeparator(' ') | |
# Split the column A into two columns using TextToColumns() method. | |
# Now column A will have first name and column B will have second name. | |
worksheet.getCells().textToColumns(0, 0, 5, txtLoadOptions) | |
# Save the excel file. | |
workbook.save(output_directory + "outputTextToColumns.xlsx") |