Aspose.Words导出带图片人员信息到Word中

时间:2021-07-30 06:20:22

Aspose.Words初学者,请指教!

1.先在你的项目中引入Aspose.Words.dll

2.导出带图片人员信息到Word中代码如下:

 protected void btn_DownDoc_Click(object sender, EventArgs e)
        {

            //实例化一个新的Word Document

            //也可以在Aspose.Words.Document doc = new Aspose.Words.Document(path)中加path参数,

          

  //此path指向你设计好的Word模板路径
            Aspose.Words.Document doc = new Aspose.Words.Document();
            DocumentBuilder builder = new DocumentBuilder(doc);
            //设置单元格内容对齐方式
            builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;

            //清除设置

            builder.PageSetup.ClearFormatting();
            string sql = "select xyxz.fid,xyxz.name as xz,xyxz.ord_no,xy.* " +
                       "from jw_xyxx xy " +
                       "inner join g_infos g on g.id=xy.info_id and g.deleted<>-1 " +
                       "inner join sub_file_relation sub on sub.info_id=xy.info_id " +
                       "inner join jw_bcgl bc on bc.info_id=sub.finfo_id " +
                       "inner join g_infos g2 on g2.id=bc.info_id and g2.deleted<>-1 " +
                       "left join ( " +
                       "select wo.name,rel1.fid,rel1.ord_no,rel1.rel_id from jw_classframework_rel rel1 " +
                       "inner join jw_classframework_rel rel2 on rel1.fid=rel2.id and rel1.bcinfo_id=rel2.bcinfo_id " +
                       "inner join jw_classframework wo on rel2.rel_id=wo.id and rel2.bcinfo_id=wo.bcinfo_id " +
                       "where rel1.bcinfo_id='"+myuser.ClassList[0].ClassID+"' " +