1金币
使用以下方法插入行及内容到新的SheetView中,但自动换行的格式没有过去。
请问我如何设置可以将自动换行也同步过去。
图1模板是自动换行的。图2添加以后未自动换行
private void AddPage(SheetView sv, int RowIndex, int tpId)
{
FpSpread Spread2 = new FpSpread();
Spread2.Open(p_certif.GetRecdTempFile(tpId, false));
sv.AddRows(RowIndex, Spread2.Sheets[0].RowCount);
for (int r = 0; r < Spread2.Sheets[0].RowCount; r++)
{
for (int c = 0; c < Spread2.Sheets[0].ColumnCount; c++)// copy span;
{
var spans = Spread2.Sheets[0].GetSpanCell(r, c);
if (spans != null && spans.Row == r && spans.Column == c)
{
sv.AddSpanCell(RowIndex + r, c, spans.RowCount, spans.ColumnCount);
}
var cell = Spread2.Sheets[0].Cells[r, c];
if (!String.IsNullOrEmpty(cell.Formula))//copy formula and value
{
sv.SetFormula(RowIndex + r, c, cell.Formula);
}
else
{
sv.SetValue(RowIndex + r, c, cell.Value);
}
sv.SetTag(RowIndex + r, c, cell.Tag);
var style2 = Spread2.Sheets[0].GetStyleInfo(r, c);
if (style2 != null)
{
//style2 = Spread2.Sheets[0].GetStyleInfo(r, c, new StyleInfo());
sv.SetStyleInfo(RowIndex + r, c, style2);
}
}
}
}
|
|