zoukankan      html  css  js  c++  java
  • Aspose使用小技巧

    该技巧用于已有表格的填写。

    比如说:

    在要填写的地方加上书签。

    数据读入代码:

                    Document dutyDoc = new Document(@"./xxxx.docx");
                    dutyDoc.Range.Bookmarks["ProjectName"].Text = moduleName;//书签名字,英文。
                    dutyDoc.Range.Bookmarks["ProjectName1"].Text = moduleName;//书签名字,英文。
                    dutyDoc.Range.Bookmarks["ProjectName2"].Text = moduleName;
                    dutyDoc.Range.Bookmarks["SafeCode"].Text = safetyManagerment.SafeCode;
                    dutyDoc.Range.Bookmarks["DutyManagement"].Text = safetyManagerment.DutyManagement;
                    dutyDoc.Range.Bookmarks["IllegaTime"].Text = safetyManagerment.IllegaTime.ToString("yyyy/MM/dd");
                    dutyDoc.Range.Bookmarks["Place"].Text = safetyManagerment.Place;
                    dutyDoc.Range.Bookmarks["ProjectStepName"].Text = safetyManagerment.ProjectStepName;
                    dutyDoc.Range.Bookmarks["IllegalPerson"].Text = safetyManagerment.IllegalPerson;
                    dutyDoc.Range.Bookmarks["Behavior"].Text = safetyManagerment.Behavior;
                    dutyDoc.Range.Bookmarks["IllegaType"].Text = safetyManagerment.IllegaType;
                    dutyDoc.Range.Bookmarks["IllegaType1"].Text = safetyManagerment.IllegaType;
                    dutyDoc.Range.Bookmarks.Clear();
                    SaveFileDialog dialog = new SaveFileDialog();
                    dialog.Filter = "(Word文档)*.docx,*.doc|*.docx;*.doc";
                    dialog.Title = "导出Word";
                    dialog.FileName = "(" + "考核通知单" + ")" + DateTime.Now.ToString("yyyyMMddHHmm") + ".docx";
                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string fileName = dialog.FileName;
                        dutyDoc.Save(fileName);
                    }
  • 相关阅读:
    原生ajax书写
    java 中的instanceof
    Leetcode-Python3
    快速读入挂
    HDU 6044 Limited Permutation(2017多校)【计数 快速读入挂 线性逆元】
    HDU 6015 Colorful Tree(2017多校)
    HDU 6034 【贪心】
    POJ 3415 Common Substrings 【长度不小于 K 的公共子串的个数】
    POJ Football Game 【NIMK博弈 && Bash 博弈】
    2018
  • 原文地址:https://www.cnblogs.com/FlyStupidBird/p/6277919.html
Copyright © 2011-2022 走看看