zoukankan      html  css  js  c++  java
  • C#Excel转图片代码

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using Aspose.Cells;
    
    using Aspose.Cells.Rendering;
    
    
     public void ExcelTopngImg(string xlsFile,string picFile)
            {
    
                Workbook book = new Workbook(xlsFile);
    
                Worksheet sheet = book.Worksheets[0];
                sheet.PageSetup.LeftMargin = 0;
                sheet.PageSetup.RightMargin = 0;
                sheet.PageSetup.BottomMargin = 0;
                sheet.PageSetup.TopMargin = 0;
    
    
                ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
    
                //imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
                imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
    
    
                imgOptions.OnePagePerSheet = true;
    
                imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
    
    
    
                SheetRender sr = new SheetRender(sheet, imgOptions);
    
                sr.ToImage(0, picFile);
    
            }
    学习更多加资料

     

  • 相关阅读:
    scala中List、Array、ListBuffer、ArrayList、Set
    Spark Pipeline
    Spark MLlib
    minikube
    proxychains 安装
    网络性能测试
    Flexvolume
    kubectl 获取信息
    centos7 莫名重起的问题
    fio 测试磁盘
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15627414.html
Copyright © 2011-2022 走看看