首页 > 代码库 > 首次发布
首次发布
恶趣味 阿斯顿
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; }
首次发布
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。