日期:2014-05-17 浏览次数:20505 次
public static bool PPTToPdf(string sourcePath, string targetPath, PpSaveAsFileType targetFileType)
{
bool result;
object missing = Type.Missing;
ApplicationClass application = null;
Presentation persentation = null;
try
{
application = new ApplicationClass();
persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
persentation.SaveAs(targetPath, targetFileType, Microsoft.Office.Core.MsoTriState.msoTrue);
result = true;
}
}
List<string> _fontNames = new List<string>();
foreach (PowerPoint.Slide slide in persentation.Slides)
{
foreach (PowerPoint.Shape shape in slide.Shapes)
{
if (shape.HasTextFrame ==MsoTriState.msoTrue &&
shape.TextFrame.HasText == MsoTriState.msoTrue)
{
PowerPoint.TextRange textRange = shape.TextFrame.TextRange;