0

我使用此代码通过 C# 创建一个 excel 单元格。

/// <summary>
/// Writes the text cell value.
/// </summary>
/// <param name="row">The row.</param>
/// <param name="col">The col.</param>
/// <param name="value">The string value.</param>
public void WriteCell(int row, int col, string value)
{
  ushort[] clData = { 0x0204, 0, 0, 0, 0, 0 };
  int iLen = value.Length;
  byte[] plainText = Encoding.UTF8.GetBytes(value);
  clData[1] = (ushort)(8 + iLen);
  clData[2] = (ushort)row;
  clData[3] = (ushort)col;
  clData[5] = (ushort)iLen;
  WriteUshortArray(clData);
  writer.Write(plainText);
}

添加合并单元格需要进行哪些更改?

4

1 回答 1

0

这是来自 Microsoft How Do I: Create Excel Spreadsheets using LINQ to XML?

除了以专有格式编写excel文件外,还有其他方法,例如:http ://epplus.codeplex.com/ ?

我不建议使用 Microsoft Excel BIFF 格式。

于 2013-04-28T06:57:43.010 回答