Other API Samples

Live SpreadsheetGear API Samples

Snippets Orientation

Demonstrates using the various text orientations for cell text.

IWorkbook workbook = Factory.GetWorkbook();
IWorksheet worksheet = workbook.ActiveWorksheet;
IRange cells = worksheet.Cells;
cells["A2"].Value = "Angle Up";
cells["A2"].Orientation = 45;
cells["B2"].Value = "Angle Down";
cells["B2"].Orientation = -45;
cells["C2"].Value = "Upward";
cells["C2"].Orientation = Orientation.Upward;
cells["D2"].Value = "Downward";
cells["D2"].Orientation = Orientation.Downward;
cells["E2"].Value = "Vertical";
cells["E2"].Orientation = Orientation.Vertical;
cells["A2:E2"].VerticalAlignment = VAlign.Center;
cells["A2:E2"].HorizontalAlignment = HAlign.Center;
cells["A2:A9,B2:B9,C2:C9,D2:D9,E2:E9"].Merge();
Run This Sample
Render Image

Generate an image representation of the results of this sample, which uses the SpreadsheetGear.Drawing.Image class to convert ranges, charts and shapes to images.


Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.