1、用代码打开ppt档时,
powerpoint = new PowerPoint.ApplicationClass();
ppt = powerpoint.Presentations.Open(Filename, //打开的档案名
Microsoft.Office.Core.MsoTriState.msoTrue, //是否只读
Microsoft.Office.Core.MsoTriState.msoFalse, //打开的文档是否需要一个标题,当为msoTrue时,打开文档名为系统指定的名字(简报1),当为msoFalse时文档名为文档本身的名字
Microsoft.Office.Core.MsoTriState.msoFalse); //不显示窗口
参考 http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.presentations.open.aspx
Presentation Open(
string FileName,
MsoTriState ReadOnly,
MsoTriState Untitled,
MsoTriState WithWindow
)
The Untitled parameter value can be one of these MsoTriState constants.
Constant |
Description |
---|---|
msoFalse |
The default. The file name automatically becomes the title of the opened presentation. |
msoTrue |
Opens the file without a title. This is equivalent to creating a copy of the file. |
2、 使用虚拟机Bullzip PDF Printer打印office档为pdf档时,调用方法分别为:
ppt档打印 :ppt.PrintOut(-1, -1, null, 1, Microsoft.Office.Core.MsoTriState.msoTrue);
xls档打印 :xls.PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName);
doc档打印 :doc.PrintOut(ref background, ref append, ref range, ref OutputFileName, ref missing, ref missing,
ref missing, ref missing, ref missing, ref PageType, ref printToFile, ref collate, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
其中ppt的PrintOut第三个参数如果为文件名,则将文件打印成以其为文件名的.ps档,如果为空,则将档案送到打印机打印,即转化为pdf档。
xls和doc档的PrintOut函数,当PrintToFile为true的时候,则将文件打印成以prToFileName和OutputFileName为文件名的.ps档,当PrintToFile为false的时候,则将档案送到打印机打印,即转化为pdf档。
参考:http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint._presentation.printout.aspx
ppt PrintOut函数:
void PrintOut( int From, int To, string PrintToFile, int Copies, MsoTriState Collate )
The Collate parameter value can be one of these MsoTriState constants.
Constant |
Description |
---|---|
msoFalse |
Prints all copies of one page before printing the first copy of the next page. |
msoTrue |
Prints a complete copy of the presentation before the first page of the next copy is printed. |
xls PrintOut函数 http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet.printout.aspx