Ändra storlek på rader och kolumner
Contents
[
Hide
]
Ibland är cellvärden bredare än cellen de är i eller går över flera rader. Sådana värden syns inte helt för användare om de inte ändrar höjden och bredden på rader och kolumner. Aspose.Cells.GridWeb stöder fullt ut att ställa in radhöjder och kolumnbredder. Detta ämne diskuterar dessa funktioner i detalj med hjälp av exempel.
Arbeta med radhöjder och kolumnbredder
Ange radhöjd
För att ställa in höjden på en rad:
- Lägg till Aspose.Cells.GridWeb-kontrollen i ditt webbformulär.
- Få åtkomst till Cells-samlingen i kalkylarket.
- Ställ in höjden på alla celler i valfri angiven rad.
SetRowHeight och SetColumnWidth-metoden i Cells-samlingen har också varianter tillgängliga för att ställa in radhöjd och kolumnbredds mätningar i tum och pixlar.
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 | |
// Get row index entered by user | |
int rowIndex = Convert.ToInt16(txtRowIndex.Text.Trim()); | |
// Get row height entered by user | |
int rowHeight = Convert.ToInt16(txtRowHeight.Text.Trim()); | |
// Accessing the cells collection of the worksheet that is currently active | |
GridCells cells = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex].Cells; | |
// Resize row at specified index to specified height | |
cells.SetRowHeight(rowIndex, rowHeight); |
Ange kolumnbredd
För att ställa in bredden på en kolumn:
- Lägg till Aspose.Cells.GridWeb-kontrollen i ditt webbformulär.
- Få åtkomst till Cells-samlingen i kalkylarket.
- Ställ in bredden på alla celler i valfri angiven kolumn.
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 | |
// Get column index entered by user | |
int columnIndex = Convert.ToInt16(txtColumnIndex.Text.Trim()); | |
// Get column width entered by user | |
int columnWidth = Convert.ToInt16(txtColumnWidth.Text.Trim()); | |
// Accessing the cells collection of the worksheet that is currently active | |
GridCells cells = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex].Cells; | |
// Resize column at specified index to specified width | |
cells.SetColumnWidth(columnIndex, columnWidth); |