qq_34245107
2016-04-07 01:31
采纳率: 100%
浏览 2.9k

C#中npoi或者其他方法导出word文档完整前后台代码

我想用C#做个简历导出的类似功能,但是导出word格式时存在问题,请大神指教,最好有完整前后台代码 最好简单点

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 足球中国 2016-04-08 02:38
    已采纳

    XWPFParagraph p0 = doc.CreateParagraph();
    p0.SetAlignment(ParagraphAlignment.LEFT);
    XWPFRun r0 = p0.CreateRun();
    r0.SetFontFamily("宋体");
    r0.SetFontSize(18);
    r0.SetBold(true);
    r0.SetText("未登录过学生的账号密码");

            XWPFParagraph p1 = doc.CreateParagraph();
            p1.SetAlignment(ParagraphAlignment.LEFT);
            XWPFRun r1 = p1.CreateRun();
            r1.SetFontFamily("宋体");
            r1.SetFontSize(10);
            r1.SetBold(true);
            r1.SetText("(备注:已登录过的学生密码不显示)");
    
            XWPFParagraph p2 = doc.CreateParagraph();
            p2.SetAlignment(ParagraphAlignment.LEFT);
            XWPFRun r2 = p2.CreateRun();
            r2.SetFontFamily("宋体");
            r2.SetFontSize(10);
            r2.SetBold(true);
            r2.SetText("学校:XX一中");
    
            XWPFParagraph p3 = doc.CreateParagraph();
            p3.SetAlignment(ParagraphAlignment.LEFT);
            XWPFRun r3 = p3.CreateRun();
            r3.SetFontFamily("宋体");
            r3.SetFontSize(10);
            r3.SetBold(true);
            r3.SetText("班级:(7)");
    
            XWPFParagraph p4 = doc.CreateParagraph();
            p4.SetAlignment(ParagraphAlignment.LEFT);
            XWPFRun r4 = p4.CreateRun();
            r4.SetFontFamily("宋体");
            r4.SetFontSize(10);
            r4.SetBold(true);
            r4.SetText("班主任:ddd");
    
    
            XWPFParagraph p5 = doc.CreateParagraph();
            p5.SetAlignment(ParagraphAlignment.LEFT);
            XWPFRun r5 = p5.CreateRun();
            r5.SetFontFamily("宋体");
            r5.SetFontSize(10);
            r5.SetBold(true);
            r5.SetText("可以在此处添加备注:");
    
    点赞 打赏 评论
  • 足球中国 2016-04-08 02:39

    doc.Write(new FifleStream("文件名"))

    点赞 打赏 评论

相关推荐