导出图片到Excel-完整Job
2009-04-26 12:10
465 查看
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);
}
{
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);
}
相关文章推荐
- 将图片导出到Excel中(poi导出)
- 导出excel 带有图片 或其它功能
- DataSet导出到Excel比较完整的解决方案(一)--客户端生成文件
- powershell 按原始大小导出excel中的图片
- 把图片导出到excel中
- DateTable 导出到Excel中(带样式,图片,连接,公式)
- 用NPOI插件把GridView上的图片导出到Excel的记录
- 将eChart图片利用POI导出到Excel
- DataTable 导出Excel 带图片.
- NPOI 导出数据到Excel(包括图片)
- PHPEXCEL导出EXCEL,PHPEXCEL导出EXCEL带图片
- EXCEL 批量导出图片
- POI导出图片到Excel 用的Jar包是POI3.10 & JFreechart1.0.17
- ireport导出excel,html.pdf等格式完整实例
- 关于ArcMap导出完整(高分辨率)的图片的问题
- asp.net 导出excel带图片
- DataSet导出到Excel比较完整的解决方案(二)--服务器端生成文件(downmoon)
- DataSet导出到Excel比较完整的解决方案(一)--客户端生成文件(downmoon)
- 使用Python导出Excel图表以及导出为图片的方法
- PHP导出Excel文件时导出列的数字长度太长时显示不完整或者乱码显示