예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.WordReader.WordDocument doc = new PageOffice.WordReader.WordDocument();
        Byte[] bWord;

        // 读取数据区域PO_test1中的内容,保存为一个新的word文档:new1.doc
        PageOffice.WordReader.DataRegion dr1 = doc.OpenDataRegion("PO_test1");
        bWord = dr1.FileBytes;
        Stream s1 = new FileStream(Server.MapPath("doc/") + "new1.doc", FileMode.Create);

        s1.Write(bWord, 0, bWord.Length);
        s1.Close();

        // 读取数据区域PO_test2中的内容,保存为一个新的word文档:new2.doc
        PageOffice.WordReader.DataRegion dr2 = doc.OpenDataRegion("PO_test2");
        bWord = dr2.FileBytes;
        Stream s2 = new FileStream(Server.MapPath("doc/") + "new2.doc", FileMode.Create);

        s2.Write(bWord, 0, bWord.Length);
        s2.Close();

        // 读取数据区域PO_test3中的内容,保存为一个新的word文档:new3.doc
        PageOffice.WordReader.DataRegion dr3 = doc.OpenDataRegion("PO_test3");
        bWord = dr3.FileBytes;
        Stream s3 = new FileStream(Server.MapPath("doc/") + "new3.doc", FileMode.Create);

        s3.Write(bWord, 0, bWord.Length);
        s3.Close();

        doc.Close();
    }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.WordReader.WordDocument wordDoc     = new PageOffice.WordReader.WordDocument();
     PageOffice.WordReader.DataRegion   dataRegion1 = wordDoc.OpenDataRegion("PO_image");
     //将提取的图片保存到服务器上,图片的名称为:a.jpg
     dataRegion1.OpenShape(1).SaveAsJPG(Server.MapPath("doc/a.jpg"));
     wordDoc.CustomSaveResult = "保存成功,文件保存到:" + Server.MapPath("doc/a.jpg");
     wordDoc.Close();
 }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.WordReader.WordDocument doc = new PageOffice.WordReader.WordDocument();
        //获取提交的数值
        PageOffice.WordReader.DataRegion dataUserName = doc.OpenDataRegion("PO_userName");
        PageOffice.WordReader.DataRegion dataDeptName = doc.OpenDataRegion("PO_deptName");
        content += "公司名称:" + doc.GetFormField("txtCompany");
        content += "<br/>员工姓名:" + dataUserName.Value;
        content += "<br/>部门名称:" + dataDeptName.Value;

        doc.ShowPage(400, 300);
        doc.Close();
    }