Importing tabdelmeted data to .Cells

I have program that outputs the data as a .tab file. It uses Array of Classes (each class has one row). it loops though the Array of Classes and uses a overload ToString() to get all the data as a single tab delimeted string. Then it saves all the stringbuilder to a file.

I want to now save this as a excel file using .Cells. If I use importarray function. the .Cells doesn't convert any of the number text into numbers. (When the tab file is opened by Excel the numbers are converted).

int importcounter = 1;
foreach (clsItemPlanItem aItem in aryItems)
{
string[] AryLines = aItem.ToString().Split('\t');
wrksheet.Cells.ImportArray(AryLines, importcounter, 0, false);
importcounter++;
}

I really want the the control order of the data to be controled by the Class.

How do I get .Cells to convert the Data?

Hi,

Thank you for considering Aspose.

Well, data conversion is not supported in Cells.ImportArray method. Please use Cell.PutValue(string, true) method to put the values one by one into the cells from Array.

Thank You & Best Regards,

Ok.. that works.. But when it comes to the date, It does change the value as a date, but when Excel file is opened it shows numbers instead of the date.

40135 instead of 11/18/2009

Hi,

Well, that 's true and the reason is MS Excel does store the dates in numeric values and you have to format those date values accordingly e.g
worksheet.Cells[“A1”].Style.Custom = “m/d/yyyy”;

See the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-display-formats-of-numbers-dates.html


Thank you.