Free Support Forum - aspose.com

How to write vertically in a single column

Hi can anyone tell me how to write data vertically in a column. I have attached a sample in which there is a single line under column "A". Please tell me how can I do that.

Thanks

Hi ,

Please try the following codes:

Workbook workbook = new Workbook();
Column column = workbook.Worksheets[0].Cells.Columns[0];
Style style = column.Style;
style.Rotation = 90;
StyleFlag styleFlag = new StyleFlag();
styleFlag.Rotation = true;
column.ApplyStyle(style, styleFlag);

Thanks for your reply, but how to put text in that column vertically?

Hi,

Thanks for considering Aspose.

Having seen your template excel file, May the following code help you for your need as it will give you some insight and you may design your required worksheet applying the formattings:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
//Merging cells to make A3 cell.
cells.Merge(2,0,8,1);
//Now put data into that merged cell.
cells["A3"].PutValue("Spend Details");
//Specifying vertical style of the merged cell.
Style stl = workbook.Styles[workbook.Styles.Add()];
stl.Rotation = 90;
stl.Font.Name = "Calibri";
stl.Font.Size = 14;
stl.VerticalAlignment = TextAlignmentType.Center;
stl.HorizontalAlignment = TextAlignmentType.Center;
cells["A3"].Style = stl;
workbook.Save("d:\\test\\mergingstyle.xlsx",FileFormatType.Excel2007Xlsx);

Thank you.

Thanks , its working.