zoukankan      html  css  js  c++  java
  • 导出图片到Excel完整Job

    static void ExportImageToExcel(Args _args)

    {

           container ImaPos;

           COM comWorksheet;

           COM comShapes;

           COM comCells;

           COM comFont;

           COM comPageSetup;

           SysExcelWorksheet sheet;

           SysExcelApplication excel;

           SysExcelWorkbooks books;

           SysExcelWorkbook book;

           SysExcelWorksheets sheets;

           SysExcelCells cells;

           COMVariant variant = new COMVariant();

           COMVariant xpos = new COMVariant();

           COMVariant ypos = new COMVariant();

           COMVariant state = new COMVariant();

           COMVariant width = new COMVariant();

           COMVariant height = new COMVariant();

     

           image MyImage=new image();

           str 200 FileName;

           container newPos;

           int _nheight;

           real _ywidth,_yheight,curRow,curCol;

           ;

           curCol=1;

           _ywidth=1;

           _yheight=1;

           FileName='D://My Pictures//Good Pic//1600FG100_013.jpg';

           if (FileName)

           {

                  excel = SysExcelApplication::construct();

                  books = excel.workbooks();

                  book = books.add();

                  sheets = book.worksheets();

                  sheet = sheets.itemFromNum(1);

     

                  cells=sheet.cells();

                  variant.int(-4167);

                  comWorkSheet=sheet.comObject();

     

                  comPageSetup = comWorkSheet.PageSetup();

                  comPageSetup.LeftMargin(28);

                  comPageSetup.RightMargin(28);

     

                  comCells=comWorkSheet.Cells();

                  comFont=comCells.Font();

                  comFont.size(9);

     

                  comCells.rowheight(16.5);

                  comCells.ColumnWidth(8.435);

     

           }

           MyImage.loadImage(FileName);

           try

           {

                  variant.bStr(FileName);

                  xpos.int(1);

                  ypos.int(1);

                  state.int(2);

                  width.int(MyImage.width());

                  height.int(MyImage.height());

                  comShapes = comWorkSheet.shapes();

                  comShapes.addPicture(variant,1,1,_ywidth,_yheight,width,height);

           }

           catch(Exception::Error)

           {

                  comWorkSheet.close();

                  excel.quit();

           }

           excel.visible(true);

    }

  • 相关阅读:
    2014年工作总结
    正则表达式语法规则
    按照事务类型分析 DB2 事物的性能
    DB2定位锁等待
    深入研究线程池
    WebSphere应用服务器内存泄漏探测与诊断工具选择最佳实践
    一次WebSphere性能问题诊断过程
    WebSphere Application Server诊断和调优
    将 Spring 和 Hibernate 与 WebSphere Application Server 一起使用
    Websphere Application Server 环境配置与应用部署最佳实践
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2761589.html
Copyright © 2011-2022 走看看