• 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);
    
            }
    学习更多加资料

     

  • 相关阅读:
    筛选法求素数
    C/C++经典面试题目
    操作系统笔试面试基本内容
    Win32/MFC的基本概念
    STL采用的标准模板库
    数据结构基本概念
    SQL基础语句
    C/C++基础概念
    计算机网络基础概念
    流水作业 批作业调度
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15627414.html
Copyright © 2020-2023  润新知