码迷,mamicode.com
首页 > 其他好文 > 详细

首次发布

时间:2014-12-14 22:34:33      阅读:318      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   os   sp   for   on   

恶趣味 阿斯顿

alert(1);

  1 alert(1); 

try
                {
                    Aspose.Words.Document doc = new Aspose.Words.Document(templateFile);
                    Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
                    
                    List<double> widthList = new List<double>();
                    for (int i = 0; i < 13; i++)
                    {
                        builder.MoveToCell(0, 2, i, 0); //移动单元格
                        double width = builder.CellFormat.Width;//获取单元格宽度
                        widthList.Add(width);
                    }

                    builder.MoveToBookmark("table");        //开始添加值

                    Table table = builder.StartTable();
                    builder.RowFormat.HeadingFormat = true;
                    builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;

                    for (int j = 0; j < 26; j++)
                    {
                        builder.InsertCell();// 添加一个单元格                    
                        builder.CellFormat.Borders.LineStyle = LineStyle.Single;
                        builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
                        int cellIndex = (j > 12) ? (j-13) : j; //位于第几个单元格
                        builder.CellFormat.Width = widthList[cellIndex];
                        builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
                        builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐

                        builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
                        if (cellIndex == 0 || cellIndex == 1 || cellIndex == 12)
                        {
                            if (j > 12)
                            {
                                builder.CellFormat.VerticalMerge = CellMerge.Previous;
                            }
                            else
                            {
                                builder.CellFormat.VerticalMerge = CellMerge.First;
                            }
                        }
 
                        builder.Write("测试" + j.ToString());
                        if (cellIndex == 12 )
                        {
                            builder.EndRow();
                        }
                    }
                    builder.EndTable();

                    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;
                }

 

 

首次发布

标签:style   blog   io   ar   color   os   sp   for   on   

原文地址:http://www.cnblogs.com/brokethunder/p/4163091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!