但是如果我设置居中,第二行数据是靠左的,其余是居中的,是我设置的问题吗? for (int i = 0; i < FpSpread1.Sheets[0].ColumnCount; i++)
{
this.FpSpread1.Sheets[0].Columns.VerticalAlign = VerticalAlign.Middle;
this.FpSpread1.Sheets[0].Columns.Border = new Border(BorderStyle.Solid, Color.Black);
if (i < 2)
{
this.FpSpread1.Sheets[0].Columns.HorizontalAlign = HorizontalAlign.Center;
}
else
{
this.FpSpread1.Sheets[0].Columns.HorizontalAlign = HorizontalAlign.Left;
}
if (i == FpSpread1.Sheets[0].ColumnCount - 1)
{
this.FpSpread1.Sheets[0].Columns.Width = 120;
}
}
//FpSpread1.SaveChanges();
for (int i = 0; i < FpSpread1.Sheets[0].RowCount; i++)
{
FpSpread1.Sheets[0].Cells[i, 1].CellType = ctCategory;
FpSpread1.Sheets[0].Cells[i, 1].HorizontalAlign = HorizontalAlign.Left;
FpSpread1.Sheets[0].Cells[i, 1].Value = FpSpread1.Sheets[0].Cells[i, 2].Value;
} |