Improve Office docsments support; Fix #13 (with flaws).

This commit is contained in:
Paddy Xu
2017-05-20 15:57:52 +03:00
parent 44187f845a
commit a4aeea4a58
2 changed files with 9 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ namespace QuickLook.Plugin.OfficeViewer
break;
case ".xls":
case ".xlsx":
case ".xlsm":
FileType = FileTypeEnum.Excel;
break;
case ".ppt":
@@ -144,16 +145,23 @@ namespace QuickLook.Plugin.OfficeViewer
{
case FileTypeEnum.Word:
_wordApp = new Microsoft.Office.Interop.Word.Application();
_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
_wordApp.Documents.Add(_path);
succeeded = true;
break;
case FileTypeEnum.Excel:
_excelApp = new Application();
_excelApp.DisplayAlerts = false;
_excelApp.Workbooks.Add(_path);
var worksheets = _excelApp.ActiveWorkbook.Sheets;
if (worksheets != null)
foreach (Worksheet sheet in worksheets)
sheet.PageSetup.PrintGridlines = true;
succeeded = true;
break;
case FileTypeEnum.PowerPoint:
_powerpointApp = new Microsoft.Office.Interop.PowerPoint.Application();
_powerpointApp.DisplayAlerts = PpAlertLevel.ppAlertsNone;
_powerpointApp.Presentations.Open(_path);
succeeded = true;
break;

View File

@@ -23,6 +23,7 @@ namespace QuickLook.Plugin.OfficeViewer
case ".docx":
case ".xls":
case ".xlsx":
case ".xlsm":
case ".ppt":
case ".pptx":
return true;