将VB.NET PrintDocument导出到Excel

我有一个PrintPreviewDialog控件,我已经在工具栏中添加了一个额外的button,以Excel电子表格的forms导出打印预览窗口的内容。 由于该控件旨在成为任何调用代码的“黑匣子”,因此我无法访问调用代码用来组成PrintDocument的零件; 我只是有PrintDocument本身。 这是可行的吗?

下面是将附加button添加到我的PrintPreviewDialog工具栏中的代码:

Imports System.Windows.Forms Imports Microsoft.Office.Interop Imports System.Drawing Public Class myPrintPreview Private bitmap As Bitmap Sub New() InitializeComponent() Try 'Get the toolstrip from the base control Dim ts As ToolStrip = CType(Me.PrintPreviewDialog1.Controls(1), ToolStrip) 'Add a new button Dim myExportButton As ToolStripItem myExportButton = ts.Items.Add("Export", System.Drawing.Image.FromFile("C:\omnibus\testimage.png"), New EventHandler(AddressOf myExportButtonClicked)) myExportButton.DisplayStyle = ToolStripItemDisplayStyle.Image 'Relocate the item to be the second button on the toolstrip ts.Items.Insert(1, myExportButton) Catch ex As Exception MsgBox("Error code " & ex.Message) End Try End Sub End Class 

“myExportButtonClicked”是另一个程序,它应该将打印预览对话框中显示的文档内容保存为Excel.Workbook或Excel.Worksheet。

问题是,当这个控件被devise为可用于将PrintDocument传递给控件的多个应用程序时,如何访问该内容?