Free Support Forum - aspose.com

Copy and Paste-as-value

I have a text file in tab-delimited format. Some cells are represented like this: =“04”, since the leading zeroes are important to my app.
I would like to open this text file in Aspose.Excel, copy all the cells and paste-as-value so the leading characters are preserved, then save this as an Excel spreadsheet that can open in Excel and still preserve the leading zeroes.

In “normal” Excel VBA I can select a range of cells, like:

ActiveSheet.Cells.Copy()
ActiveSheet.Cells.PasteSpecial(Excel.xlPasteType.xlPasteValue)

and then save the sheet

Is there a way that Aspose.Excel can do that also?

Hi, thanks for your consideration.

You can use your own code to load the content of your text file to a string array or a datatable, then you can use Cells.ImportArray or Cells.ImportDataTable method to import the values.