Microsoft Word、Excel、PowerPoint转Pdf
Worksheet.ExportAsFixedFormat Method
Mark:
The ExportAsFixedFormat method is used to publish a workbook to either the PDF or XPS format.
Syntax:
expression .ExportAsFixedFormat(Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish)
expression A variable that represents a Workbook, Sheet, Chart, or Range object.
Parameters:
代码实现:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
// Office2Pdf.cpp : Defines the entry point for the console application.
// #include "stdafx.h" /* //导入Office类型库 #import "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\VBE6EXT.OLB" \ #import "C:\Program Files (x86)\Microsoft Office\Office14\MSWORD.OLB " \ #import "C:\Program Files (x86)\Microsoft Office\Office14\MSPPT.OLB" //使用头文件 //声明 //主函数 std::wstring wsCmd; ) wsCmd = argv[]; if(wsCmd == L"-e") ) return nRet; //实现 BSTR szBstrOutputFileName; Word::DocumentsPtr pDocs = NULL; if(pDocs==NULL) try pDoc->ExportAsFixedFormat(szBstrOutputFileName,Word::WdExportFormat::wdExportFormatPDF,VARIANT_FALSE, pDoc-> Close(); _RELEASE_APP: return nRet; int Excel2Pdf(std::wstring inputFileName,std::wstring outputFileName) szBstrInputFileName = SysAllocString(inputFileName.c_str()); if (FAILED(pApplication.CreateInstance(__uuidof(Excel::Application)))) }catch(...) pApplication-> Quit(); return nRet; int Ppt2Pdf(std::wstring inputFileName,std::wstring outputFileName) BSTR szBstrInputFileName; szBstrInputFileName = SysAllocString(inputFileName.c_str()); if (FAILED(spPpApp.CreateInstance(__uuidof(PowerPoint::Application)))) spPres = spPpApp->Presentations; try pPre->ExportAsFixedFormat(szBstrOutputFileName,PowerPoint::PpFixedFormatType::ppFixedFormatTypePDF, _RELEASE_APP: return nRet; |
Microsoft Word、Excel、PowerPoint转Pdf的更多相关文章
- Java解析OFFICE(word,excel,powerpoint)以及PDF的实现方案及开发中的点滴分享
Java解析OFFICE(word,excel,powerpoint)以及PDF的实现方案及开发中的点滴分享 在此,先分享下写此文前的经历与感受,我所有的感觉浓缩到一个字,那就是:"坑&qu ...
- word/excel/ppt 2 PDF
PHP 实现 word/excel/ppt 转换为 PDF 一般最常见的就是利用OpenOffice来转换,来看看实现的核心代码: class PDFConverter { private $com; ...
- C#.net word excel powerpoint (ppt) 转换成 pdf 文件
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- word,excel,ppt转Pdf,Pdf转Swf,通过flexpaper+swftools实现在线预览
其实这是我好几年前的项目,现在再用这种方式我也不建议了,毕竟未来flash慢慢会淘汰,此方式也是因为目测大部分人都装了flash,才这么做的,但是页面展示效果也不好.其实还是考虑收费的控件,毕竟收费的 ...
- word,excel,ppt转pdf
第一步 需要下载jar包和jacob-1.14.3-x64.dll * <dependency> * <groupId>net.sf.jacob-project</gro ...
- C#将Word,Excel与Html,PDF互转
public class OfficeHelper { /// <summary> /// word转成html /// </summary> /// <param na ...
- DataTable导出为word,excel,html,csv,pdf,.txt
using System; using System.Data; using System.Configuration; using System.Collections; using System. ...
- PHP 实现 word/excel/ppt 转换为 PDF
前段时间负责公司内部文件平台的设计,其中有一个需求是要能够在线浏览用户上传的 office 文件. 我的思路是先将 office 转换成 PDF,再通过 pdf.js 插件解析 PDF 文件,使其能在 ...
- 21.PHP实现Word/Excel/PPT转换为PDF
参考文档: https://www.cnblogs.com/woider/p/7003481.html http://blog.csdn.net/aoshilang2249/article/detai ...
随机推荐
- 基于skitter的轮播图炫酷效果,幻灯片的体验
概述 包含各种炫酷的轮播切换效果,插件小巧,与其他插件无冲突,可用于移动端和PC端 详细 代码下载:http://www.demodashi.com/demo/11939.html 你还在用原生的js ...
- 点滴记录——在Ubuntu 14.04中使SublimeText 3支持中文输入法
在Ubuntu 14.04中安装了SublimeText 3之后发现既然不支持输入中文,于是在网上搜罗一下,发现非常多人遇到了相同的问题,可是解决的方法大该就仅仅有一个.以下依据自身的安装及解决的方法 ...
- 去掉A标签的虚线框
outline是css3的一个属性,用的很少. 声明,这是个不能兼容的css属性,在ie6.ie7.遨游浏览器都不兼容. outline控制的到底是什么呢? 当聚焦a标签的时候,在a标签的区域周围会有 ...
- mysql索引二
理解MySQL——索引与优化 写在前面:索引对查询的速度有着至关重要的影响,理解索引也是进行数据库性能调优 的起点.考虑如下情况,假设数据库中一个表有10^6条记录,DBMS的页面大小为4K,并存储1 ...
- 使用PsExec tool在Session 0下运行程序
在Service程序中使用OutputDebugString输出log信息, 在当前用户直接运行DbgView.exe, log信息是不会输出到DbgView窗口的.原因是Server程序运行在Ses ...
- appium 1.6.3 + ios 10.2 + xcode 8.2.1 真机运行iphone app
appium命令行启动: appium --address "127.0.0.1" --session-override --pre-launch --debug-log-spac ...
- [原]C#设置文件夹用户权限
var security = new DirectorySecurity(); string path=@"C:\temp" //设置权限的应用为文件夹本身.子文件夹及文件,所 ...
- 安卓-启动下一个Activity
Intent intent = new Intent(NotebookActivity.this, MessageActivity.class); startActivity(intent); 通过意 ...
- android.animation(4) - ObjectAnimator的ofInt(), ofFloat()(转)
一.概述 1.引入 上几篇给大家讲了ValueAnimator,但ValueAnimator有个缺点,就是只能对数值对动画计算.我们要想对哪个控件操作,需要监听动画过程,在监听中对控件操作.这样使用起 ...
- How to export Excel files in a Python/Django application
https://assist-software.net/blog/how-export-excel-files-python-django-application CONTENTS Introduct ...