Ci-dessous le code source C# pour le faire avec . Puisque l'API SpreadsheetGear est similaire à l'API d'Excel, vous devriez pouvoir facilement adapter ce code à l'API d'Excel pour obtenir le même résultat.
Vous pouvez télécharger un essai gratuit here si vous voulez l'essayer vous-même.
Disclaimer: Je possède SpreadsheetGear LLC
using System;
using SpreadsheetGear;
namespace Program
{
class Program
{
static void Main(string[] args)
{
// Create a new workbook and get a reference to A1.
IWorkbook workbook = Factory.GetWorkbook();
IWorksheet worksheet = workbook.Worksheets[0];
IRange a1 = worksheet.Cells["A1"];
// Format A1 as Text using the "@" format so that the text
// will not be converted to a number, and put the text in A1.
a1.NumberFormat = "@";
a1.Value = "89234010000725515875";
// Show that the formatted value is
Console.WriteLine("FormattedValue={0}, Raw Value={1}", a1.Text, a1.Value);
// Save the workbook.
workbook.SaveAs(@"c:\tmp\Text.xls", FileFormat.Excel8);
workbook.SaveAs(@"c:\tmp\Text.xlsx", FileFormat.OpenXMLWorkbook);
}
}
}