有用aspose.words的吗,请问单元格内容如何水平居中呢?
Document doc = new Document(path);
DocumentBuilder builder1 = new DocumentBuilder(doc);
builder1.MoveToBookmark("zyb");
builder1.RowFormat.Alignment = RowAlignment.Center;//用这个效果居然是整个表格在页面居中...
builder1.InsertCell();
builder1.CellFormat.Width = 50;
builder1.Write("表头1");
builder1.InsertCell();
builder1.CellFormat.Width = 100;
builder1.Write("表头2");
builder1.InsertCell();
builder1.CellFormat.Width = 360;
builder1.Write("表头3");
builder1.EndRow();
for (int i = 0; i < 25; i++)
{
builder1.InsertCell();
builder1.CellFormat.Width = 50;
builder1.Write("列1" + i);
builder1.InsertCell();
builder1.CellFormat.Width = 100;
builder1.Write("列2" + i);
builder1.InsertCell();
builder1.CellFormat.Width = 360;
builder1.Write("列3" + i);
builder1.EndRow();
}
builder1.EndTable();
doc.Range.Bookmarks["zyb"].Text = "";