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
)
Parameters
-
FileName
-
Type:
System.String
The name of the file to open.
-
ReadOnly
-
Type:
MsoTriState
Specifies whether the file is opened with read/write or read-only status.
-
Untitled
-
Type:
MsoTriState
Specifies whether the file has a title.
-
WithWindow
-
Type:
MsoTriState
Specifies whether the file is visible.
Return Value
Type: Microsoft.Office.Interop.PowerPoint.PresentationThe 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 )
Parameters
-
From
-
Type:
System.Int32
The number of the first page to be printed. If this argument is omitted, printing starts at the beginning of the presentation. Specifying the To and From arguments sets the contents of the PrintRanges object and sets the value of the RangeType property for the presentation.
-
To
-
Type:
System.Int32
The number of the last page to be printed. If this argument is omitted, printing continues to the end of the presentation. Specifying the To and From arguments sets the contents of the PrintRanges object and sets the value of the RangeType property for the presentation.
-
PrintToFile
-
Type:
System.String
The name of the file to print to. If you specify this argument, the file is printed to a file rather than sent to a printer. If this argument is omitted, the file is sent to a printer.
-
Copies
-
Type:
System.Int32
The number of copies to be printed. If this argument is omitted, only one copy is printed. Specifying this argument sets the value of the NumberOfCopies property.
-
Collate
-
Type:
MsoTriState
If this argument is omitted, multiple copies are collated. Specifying this argument sets the value of the Collate property.
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
最后
以上就是受伤鞋子最近收集整理的关于office档开发遇到的问题的解决方法笔记的全部内容,更多相关office档开发遇到内容请搜索靠谱客的其他文章。
发表评论 取消回复