如何设置EXCEL打印设置“打印整个工作表”? C#

我的程序将在同一个EXCEL文件中导出WorkSheets 。 而我正在尝试将打印默认设置设置为“打印整个工作簿”。 我尝试使用PrintOutEx来设置它,但是当我导出EXCEL时,它会立即打印出worksheets或进入预览模式。

我只想将默认设置为“ Print Entire Workbook 。 我想让用户先读取excel文件。 怎么办? 谢谢。

这是我的代码:

 Excel.Application oApp; Excel.Worksheet oSheet; Excel.Workbook oBook; //Check if the row records are more then the table row. if (rowCount > 19) more_than_table = true; oApp = new Excel.Application(); oBook = oApp.Workbooks.Add(); do { Debug.WriteLine("Page: " + sheet_page); oSheet = (Excel.Worksheet)oBook.Worksheets.Add(After: oBook.Sheets[oBook.Sheets.Count]); oSheet.Name = invoices_tb.Text + "(" + sheet_page + ")"; oApp.Application.UserName = invoices_tb.Text; oApp.Visible = true; //Set up the excel page style, orientation and the center alignment //oSheet.PageSetup.Zoom = false; oSheet.PageSetup.Zoom = false; oSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape; oSheet.PageSetup.CenterHorizontally = true; oSheet.PageSetup.FitToPagesWide = 1; //Set the page number oSheet.PageSetup.CenterFooter = "Page &P of &N"; //** //Many code for set up excel and value //** double how_many_page = Convert.ToDouble(rowCount) / 19.0f ; Debug.WriteLine("many page: " + how_many_page); if (how_many_page > sheet_page) sheet_page++; else more_than_table = false; } while (more_than_table); //Set to preview the page when file export. oBook.PrintOutEx(1, sheet_page, 1, true, Type.Missing, true, false, Type.Missing); } catch (Exception ex) { MessageBox.Show("Excel Closed."); }