首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

有用aspose.words的吗,请教单元格内容怎么水平居中呢

2013-07-08 
有用aspose.words的吗,请问单元格内容如何水平居中呢?Document doc new Document(path)DocumentBuilder

有用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 = "";



暂时用的代码如上,求教。
[解决办法]
这样
  builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
  builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐

热点排行