Format de fichier délimité par des tabulations en lecture et en écriture

Scénarios d’utilisation possibles

Microsoft Excel prend en charge de nombreux formats tels que XLS, XLSX, XLSM, XLSB, CSV, délimité par des tabulations, etc. Aspose.Cells prend également en charge plusieurs de ces formats. Cet article explique comment lire et écrire le fichier Excel au format délimité par des tabulations à l’aide de Aspose.Cells.

Format de fichier délimité par des tabulations en lecture et en écriture

L’exemple de code suivant charge lefichier source délimité par des tabulations et lit sa cellule A1, puis copie son contenu dans la cellule C4 et l’enregistre sousfichier de sortie délimité par des tabulations.

Exemple de code

//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Source directory path
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\");
//Output directory path
StringPtr outPath = new String("..\\Data\\Output\\");
//Path of input tab delimited file
StringPtr srcReadWriteTabDelimited = dirPath->StringAppend(new String(L"srcReadWriteTabDelimited.txt"));
//Path of output tab delimited file
StringPtr outReadWriteTabDelimited = outPath->StringAppend(new String(L"outReadWriteTabDelimited.txt"));
//Read source tab delimited file
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(srcReadWriteTabDelimited);
//Access first worksheet
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0);
//Access cell A1
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1"));
//Get the string value of cell A1
StringPtr strVal = cell->GetStringValue();
//Print the string value of cell A1
StringPtr cellValue = new String("Cell Value: ");
Console::WriteLine(cellValue->StringAppend(strVal));
//Access cell C4
cell = ws->GetICells()->GetObjectByIndex(new String("C4"));
//Put the string value of cell A1 into C4
intrusive_ptr<String> strValPtr = new String(strVal);
cell->PutValue(strValPtr);
//Save the workbook in tab delimited format
wb->Save(outReadWriteTabDelimited, SaveFormat_TabDelimited);