Splitting a cell into 2 columns

Is there any way to programatically split a cell into 2 columns? The specific Excel feature I'm looking to do is the "Text to Columns" feature on the Data menu. Given the content of a cell and a delimiter, this function will split the content at the delimiter and move each token into the next column.

As an example, if I had a column called "Full Name" which contains values like "George Smith", "Sarah Jones", and Michael Jackson", and I wanted to split this column into a column for "First Name" and another for "Last Name" in Excel, I would add a column to the right of "Full Name" and use the Text to Columns feature to split on a blank space.

Thanks in advance,

Adam


This message was posted using Page2Forum from Aspose.Cells for .NET - Documentation

Hi Adam,

Many thanks for the nice explanation.

We understand what you are looking for but I am afraid that currently this feature is not available. The feature has been logged with ID CELLSNET-22881. We will analyze it and will update you accordingly about the implementation and availability of this new feature.

Thanks,

Hi,

Well, we think it is a simple one (Text to Columns) that you can even do by using your own code, see the code segment below:

Workbook wb = new Workbook();
wb.Worksheets[0].Cells[“A2”].PutValue(“George Smith”);
string cellValue = wb.Worksheets[0].Cells[“A2”].StringValue;
string[] arr = cellValue.Split(’ ');
if (arr.Length >= 1)
{
wb.Worksheets[0].Cells[“A2”].PutValue(arr[0]);
wb.Worksheets[0].Cells[“B2”].PutValue(arr[1]);
}

wb.Save(“e:\test2\outsplitted.xls”);


Thank you.