回复 1楼menghuanyunxia的帖子
menghuanyunxia 你好,
在有数据单元格外围插入空的行和列不会被保存到Excel,可以在添加行列时设置某个单元格格式标记添加的行列再导出,例如:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.fpSpread1.ActiveSheet.RowCount = 10;
- this.fpSpread1.ActiveSheet.ColumnCount = 10;
- this.fpSpread1.ActiveSheet.Cells[0, 0].Value = "cell00";
- this.fpSpread1.ActiveSheet.Cells[9, 9].Value = "cell99";
- }
- private void addRowsAndColsToolStripMenuItem_Click(object sender, EventArgs e)
- {
- //在无数据部分插入行、列
- this.fpSpread1.ActiveSheet.Rows.Add(10, 10);
- this.fpSpread1.ActiveSheet.Columns.Add(10, 10);
- this.fpSpread1.ActiveSheet.Cells[19, 19].ForeColor=Color.Black;
- }
- private void exportToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.fpSpread1.SaveExcel("test.xls");
- }
- private void importToolStripMenuItem_Click(object sender, EventArgs e)
- {
- this.fpSpread1.OpenExcel("test.xls", FarPoint.Excel.ExcelOpenFlags.TruncateEmptyRowsAndColumns);
- }
复制代码
不知道我是否正确理解你的问题? |