Convert cloumn into text column

Hi I need to change number column as text column, can u help in this

Hi Farook,


Thank you for contacting Aspose support.

We believe you are using Aspose.Cells API and wish to format the column of a spreadsheet. If we are correct in our understanding, please read more about Setting the Display Format and check the below provided code snippet. The source code example loads a spreadsheet having two columns of data and sets the style for the second column to text format. We have attached the input & output spreadsheets for your reference.

C#

//Instantiating a Workbook object
Workbook workbook = new Workbook(“D:/temp/book1.xlsx”);

//Obtaining the reference of the first (default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];

//Adding a new Style to the styles collection of the Excel object
int i = workbook.Styles.Add();

//Accessing the newly added Style to the Excel object
Style style = workbook.Styles[i];
//Number 49 denotes to the text style
style.Number = 49;

//Creating StyleFlag
StyleFlag styleFlag = new StyleFlag();
//Set NumberFormat to true
styleFlag.NumberFormat = true;

//Apply the style to the desired column
worksheet.Cells.Columns[1].ApplyStyle(style, styleFlag);

//Saving the Excel file
workbook.Save(“D:/temp/output.xlsx”);



In case you have further concerns or questions, please feel free to write back.