• C# 画图表


    引用DocX

    protected double bodyFontSize = 12d;
    protected float lineSpacing = 1.5f;
    protected float indentationFirstLine = 1f;
    protected double tableFontSize = 10d;


      using (var document = DocX.Create(@"Toc2.docx")) {
    document.InsertParagraph("技术参数").Font("宋体").FontSize(bodyFontSize); var columnWidths = new float[] { 150f, 180f, 150f, 150f }; var t = document.InsertTable(15, columnWidths.Length); t.SetWidths(columnWidths); t.Design = TableDesign.TableGrid; t.Alignment = Alignment.center; for (int i = 0; i < t.RowCount; i++) { for (int j = 0; j < t.ColumnCount; j++) { t.Rows[i].Cells[j].Paragraphs.First().Font("宋体").FontSize(8).Alignment = Alignment.center; t.Rows[i].Cells[j].VerticalAlignment = VerticalAlignment.Center; } } var row = t.Rows.First(); t.Rows[0].MergeCells(1, 2); t.Rows[0].Cells[1].Width = 330f; row.Cells[0].Paragraphs.First().Append("基坑类别").FontSize(tableFontSize); row.Cells[1].Paragraphs.First().Append("施工进度").FontSize(tableFontSize); row.Cells[2].Paragraphs.First().Append("监测频率").FontSize(tableFontSize); t.MergeCellsInColumn(0, 1, 7);//第几列,开始,结束 t.Rows[1].Cells[0].Paragraphs.First().Append(string.Format("一级")).FontSize(tableFontSize); t.MergeCellsInColumn(0, 8, 14); t.Rows[8].Cells[0].Paragraphs.First().Append(string.Format("二级")).FontSize(tableFontSize); t.MergeCellsInColumn(1, 1, 3);//第几列,开始,结束 t.Rows[1].Cells[1].Paragraphs.First().Append(string.Format("开挖深度h")).FontSize(tableFontSize); t.MergeCellsInColumn(1, 4, 7);//第几列,开始,结束 t.Rows[4].Cells[1].Paragraphs.First().Append(string.Format("底板浇筑后时间(d)")).FontSize(tableFontSize); t.MergeCellsInColumn(1, 8, 10);//第几列,开始,结束 t.Rows[8].Cells[1].Paragraphs.First().Append(string.Format("开挖深度h1")).FontSize(tableFontSize); t.MergeCellsInColumn(1, 11, 14);//第几列,开始,结束 t.Rows[11].Cells[1].Paragraphs.First().Append(string.Format("底板浇筑后时间(d)")).FontSize(tableFontSize); t.Rows[1].Cells[2].Paragraphs.First().Append(string.Format("≤H/3")).FontSize(tableFontSize); t.Rows[1].Cells[3].Paragraphs.First().Append(string.Format("1次/3d")).FontSize(tableFontSize); t.Rows[2].Cells[2].Paragraphs.First().Append(string.Format("H/3~2H/3")).FontSize(tableFontSize); t.Rows[2].Cells[3].Paragraphs.First().Append(string.Format("1次/2d")).FontSize(tableFontSize); t.Rows[3].Cells[2].Paragraphs.First().Append(string.Format("2H/3~H")).FontSize(tableFontSize); t.Rows[3].Cells[3].Paragraphs.First().Append(string.Format("1次/d")).FontSize(tableFontSize); t.Rows[4].Cells[2].Paragraphs.First().Append(string.Format("≤7")).FontSize(tableFontSize); t.Rows[4].Cells[3].Paragraphs.First().Append(string.Format("1次/d")).FontSize(tableFontSize); t.Rows[5].Cells[2].Paragraphs.First().Append(string.Format("7~14")).FontSize(tableFontSize); t.Rows[5].Cells[3].Paragraphs.First().Append(string.Format("1次/3d")).FontSize(tableFontSize); t.Rows[6].Cells[2].Paragraphs.First().Append(string.Format("14~28")).FontSize(tableFontSize); t.Rows[6].Cells[3].Paragraphs.First().Append(string.Format("1次/5d")).FontSize(tableFontSize); t.Rows[7].Cells[2].Paragraphs.First().Append(string.Format(">28")).FontSize(tableFontSize); t.Rows[7].Cells[3].Paragraphs.First().Append(string.Format("1次/7d")).FontSize(tableFontSize); t.Rows[8].Cells[2].Paragraphs.First().Append(string.Format("≤H/3")).FontSize(tableFontSize); t.Rows[8].Cells[3].Paragraphs.First().Append(string.Format("1次/2d")).FontSize(tableFontSize); t.Rows[9].Cells[2].Paragraphs.First().Append(string.Format("H/3~2H/3")).FontSize(tableFontSize); t.Rows[9].Cells[3].Paragraphs.First().Append(string.Format("1次/5d")).FontSize(tableFontSize); t.Rows[10].Cells[2].Paragraphs.First().Append(string.Format("2H/3~H")).FontSize(tableFontSize); t.Rows[10].Cells[3].Paragraphs.First().Append(string.Format("1次/d")).FontSize(tableFontSize); t.Rows[11].Cells[2].Paragraphs.First().Append(string.Format("≤7")).FontSize(tableFontSize); t.Rows[11].Cells[3].Paragraphs.First().Append(string.Format("1次/2d")).FontSize(tableFontSize); t.Rows[12].Cells[2].Paragraphs.First().Append(string.Format("7~14")).FontSize(tableFontSize); t.Rows[12].Cells[3].Paragraphs.First().Append(string.Format("1次/3d")).FontSize(tableFontSize); t.Rows[13].Cells[2].Paragraphs.First().Append(string.Format("14~28")).FontSize(tableFontSize); t.Rows[13].Cells[3].Paragraphs.First().Append(string.Format("1次/7d")).FontSize(tableFontSize); t.Rows[14].Cells[2].Paragraphs.First().Append(string.Format(">28")).FontSize(tableFontSize); t.Rows[14].Cells[3].Paragraphs.First().Append(string.Format("1次/10d")).FontSize(tableFontSize); document.InsertParagraph("注:(1) h——基坑开挖深度;H——基坑设计深度").Font("宋体").FontSize(bodyFontSize); document.InsertParagraph(" (2) 支撑结构开始拆除到拆除完成后3d内监测频率加密为1次/d。").Font("宋体").FontSize(bodyFontSize); document.InsertParagraph(" (3) 基坑工程施工至开挖前的监测频率视具体情况确定。").Font("宋体").FontSize(bodyFontSize); //----------------------------------------------------------------------------------------------------------------------------------------------------------------

    document.InsertParagraph("技术参数").Font("宋体").FontSize(bodyFontSize).SpacingBefore(15);

    
    

    columnWidths = new float[] { 150f, 180f, 150f };
    t = document.InsertTable(5, columnWidths.Length);
    t.SetWidths(columnWidths);
    t.Design = TableDesign.TableGrid;
    t.Alignment = Alignment.center;
    for (int i = 0; i < t.RowCount; i++)
    {
    for (int j = 0; j < t.ColumnCount; j++)
    {
    t.Rows[i].Cells[j].Paragraphs.First().Font("宋体").FontSize(8).Alignment = Alignment.center;
    t.Rows[i].Cells[j].VerticalAlignment = VerticalAlignment.Center;
    }
    }
    row = t.Rows.First();
    row.Cells[0].Paragraphs.First().Append("指标").FontSize(tableFontSize);
    row.Cells[1].Paragraphs.First().Append("配套产品").FontSize(tableFontSize);
    row.Cells[2].Paragraphs.First().Append("安装方式").FontSize(tableFontSize);

    
    

    t.MergeCellsInColumn(1, 1, 4);
    t.Rows[1].Cells[0].Paragraphs.First().Append("最大量程(mm):200 ~ 2000").FontSize(tableFontSize);
    t.Rows[1].Cells[1].Paragraphs.First().Append("4芯传感器信号线缆智能无线采集终").FontSize(tableFontSize).Alignment = Alignment.center;
    t.Rows[1].Cells[2].Paragraphs.First().Append("保护外壳+螺栓固定").FontSize(tableFontSize);
    t.MergeCellsInColumn(2, 1, 4);
    t.Rows[2].Cells[0].Paragraphs.First().Append("分辨率(mm): 0.02").FontSize(tableFontSize);
    t.Rows[3].Cells[0].Paragraphs.First().Append("精度(F.S.):0.15 %").FontSize(tableFontSize);
    t.Rows[4].Cells[0].Paragraphs.First().Append("工作温度(℃): -20 ~ 80").FontSize(tableFontSize);

    
    
                   
    
    
                    document.Save();
    }

     

  • 相关阅读:
    并查集
    关于一些位运算的小记
    用ST解决RMQ问题
    寒假作业_4
    H
    卢卡斯 组合数
    并查集
    G
    F
    E
  • 原文地址:https://www.cnblogs.com/lvqianqian/p/16378907.html
Copyright © 2020-2023  润新知