Satır Yüksekliğini ve Sütun Genişliğini Ayarlama
Satırlarla Çalışmak
Satır Yüksekliğini Ayarlamak
Aspose.Cells, Microsoft Excel dosyasını temsil eden Workbook sınıfını sağlar. Workbook sınıfı, Excel dosyasındaki her çalışma sayfasına erişim sağlayan WorksheetCollection içerir. Bir çalışma sayfası, Worksheet sınıfı ile temsil edilir. Worksheet sınıfı, çalışma sayfasındaki tüm hücreleri temsil eden Cells koleksiyonunu sağlar. Cells koleksiyonu, çalışma sayfasındaki satırları veya sütunları yönetmek için birkaç yöntem sağlar. Bunlardan bazıları aşağıda daha detaylı olarak tartışılmaktadır.
Bir Satırın Yüksekliğini Ayarlama
Bir satırın yüksekliğini Cells koleksiyonunun SetRowHeight yöntemini çağırarak ayarlamak mümkündür. SetRowHeight yöntemi aşağıdaki parametreleri alır:
- Satır dizini, yüksekliği değiştirdiğiniz satırın dizini.
- Satır yüksekliği, satıra uygulanan satır yüksekliği.
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the height of the second row to 35 | |
worksheet.GetCells().SetRowHeight(1, 35); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
Bir Çalışma Sayfasındaki Tüm Satırların Yüksekliğini Ayarlama
Geliştiriciler, çalışma sayfasındaki tüm satırlar için aynı satır yüksekliğini ayarlamak istediklerinde, bunu Cells koleksiyonunun SetStandardHeight yöntemini kullanarak yapabilirler.
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Setting the height of all rows in the worksheet to 25 | |
worksheet.GetCells().SetStandardHeight(25); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
Sütunlarla Çalışmak
Bir Sütunun Genişliğini Ayarlamak
Sütunun genişliğini, Cells koleksiyonunun SetColumnWidth yöntemini çağırarak ayarlayabilirsiniz. SetColumnWidth yöntemi aşağıdaki parametreleri alır:
- Sütun dizini, genişliği değiştirdiğiniz sütunun dizini.
- Sütun genişliği, istenen sütun genişliği.
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the width of the second column to 56.5 | |
worksheet.GetCells().SetColumnWidth(1, 56.5); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
Bir Çalışma Sayfasındaki Tüm Sütunların Genişliğini Ayarlama
Çalışma sayfasındaki tüm sütunlar için aynı sütun genişliğini ayarlamak için Cells koleksiyonunun SetStandardWidth metodu kullanılır.
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the width of all columns in the worksheet to 20.5 | |
worksheet.GetCells().SetStandardWidth(20.5); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |