none
求Microsoft.Office.Interop.Excel.Dialog.Show方法详细说明 RRS feed

  • 问题

  • 这是我网上找到的资料:https://msdn.microsoft.com/zh-cn/VBA/Excel-VBA/articles/dialog-show-method-excel

    该资料对于Show方法中各参数的意义和功能未做具体说明。我在代码中只能以Show()的形式进行调用。我想能够预设对话框的尺寸和显示位置,不知道有没有参数可以达到目的?

    我的代码:

                Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();  
      
                //不可或缺  
                excelApp.Visible = true;  
      
                Microsoft.Office.Interop.Excel.Workbook wb = excelApp.Workbooks.Open("E:\\ex6.xls", Type.Missing, Type.Missing,  
                                                                                            Type.Missing, Type.Missing,  
                                                                                            Type.Missing, Type.Missing,  
                                                                                            Type.Missing, Type.Missing,  
                                                                                            Type.Missing, Type.Missing,  
                                                                                            Type.Missing, Type.Missing);  
                Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];  
                bool userDidntCancel = excelApp.Dialogs[Microsoft.Office.Interop.Excel.XlBuiltInDialog.xlDialogPrintPreview].Show(  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,  
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);  
                GC.Collect();  
                GC.WaitForPendingFinalizers();  
                wb.Close(false, Type.Missing, Type.Missing);  
                excelApp.Quit();  

    2017年12月27日 10:17