按模板生成内容,转换成长图保存:

 

Document doc = new Document("A_BizRpt.docx");

.......

Image[] imgs = doc.SaveToImages(ImageType.Metafile);

var finalHeight = imgs.Sum(img => img.Height);
var finalWidth = imgs.Max(img => img.Width);
var finalImg = new Bitmap(finalWidth, finalHeight);
Graphics g = Graphics.FromImage(finalImg);
g.Clear(SystemColors.AppWorkspace);

var height = 0;
foreach (Image img in imgs)
{
     g.DrawImage(img, new Point(0, height));
     height += img.Height;

     img.Dispose();
}
g.Dispose();
finalImg.Save("1.png", System.Drawing.Imaging.ImageFormat.Png);
finalImg.Dispose();

相关文章:

  • 2022-12-23
  • 2021-09-05
  • 2022-01-16
  • 2022-01-01
  • 2022-12-23
  • 2021-05-13
  • 2022-01-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-09-13
  • 2021-12-10
  • 2022-12-23
相关资源
相似解决方案