SheetView sheetView = this.fpSpread1.ActiveSheet;
sheetView.RowCount = 100;
sheetView.ColumnCount = 4;
sheetView.ColumnHeader.RowCount = 1;
sheetView.ColumnHeader.Cells[0, 0].Text = "A";
sheetView.ColumnHeader.Cells[0, 1].Text = "B";
sheetView.ColumnHeader.Cells[0, 2].Text = "C";
for (int i = 0; i < 100; i++)
{
if (i > 1)
{
sheetView.Cells[i, 0].Text = Convert.ToString(Math.Floor(Convert.ToDecimal(i - 2) / 4) * 4);
sheetView.Cells[i, 1].Text = Convert.ToString(i * 11);
sheetView.Cells[i, 2].Text = Convert.ToString(i * 12);
sheetView.Cells[i, 3].Text = Convert.ToString(i * 13);
}
}
FpSpread temp = new FpSpread();
MemoryStream ms = new MemoryStream();
this.fpSpread1.Save(ms, false);
temp.Open(ms);
上面的代码到temp.Open(ms);的时候就会报下面的错误
System.Xml.XmlException:Root Element Missing
环境是VS2022,.NetFramework4.8, spread.net 16
|