Dzwebs.Net

撰写电脑技术杂文十余年

aspose.words合并单元格的代码

Admin | 2015-8-28 10:24:41 | 被阅次数 | 7287

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

            try
                {
                    Aspose.Words.Document doc = new Aspose.Words.Document(templateFile);
                    Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);

                    builder.InsertCell();
                    builder.CellFormat.Borders.LineStyle = LineStyle.Single;
                    builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
                    builder.CellFormat.VerticalMerge = CellMerge.First;
                    builder.Write("Text in merged cells.");

                    builder.InsertCell();
                    builder.CellFormat.Borders.LineStyle = LineStyle.Single;
                    builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
                    builder.CellFormat.VerticalMerge = CellMerge.None;
                    builder.Write("Text in one cell");
                    builder.EndRow();

                    builder.InsertCell();
                    builder.CellFormat.Borders.LineStyle = LineStyle.Single;
                    builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
                    // This cell is vertically merged to the cell above and should be empty.
                    builder.CellFormat.VerticalMerge = CellMerge.Previous;

                    builder.InsertCell();
                    builder.CellFormat.Borders.LineStyle = LineStyle.Single;
                    builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
                    builder.CellFormat.VerticalMerge = CellMerge.None;
                    builder.Write("Text in another cell");
                    builder.EndRow();

                    doc.Save(saveDocFile);
                    if (MessageUtil.ShowYesNoAndTips("保存成功,是否打开文件?") == System.Windows.Forms.DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(saveDocFile);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Error(ex);
                    MessageUtil.ShowError(ex.Message);
                    return;
                }


该杂文来自: 网站开发杂文

上一篇:aspose.words插入表格的代码

下一篇:Aspose.Words的特点

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计