我正在尝试使用 pastespecial 方法将格式化的单元格从现有的 excel 工作表复制到 vb.net(2010) 中的新工作表,但它将单元格值粘贴为图片而不是文本。在这方面的任何帮助将不胜感激:
    Public Sub set_header(ByVal r As Integer, ByVal c As Integer, ByVal dt1 As Date, ByVal dt2 As Date, ByVal sheetname As String)
    Dim wbCopy As Excel.Workbook
    Dim wsCopy As Excel.Worksheet
    Dim rngCopy As Excel.Range
    Dim wbPaste As Excel.Workbook
    Dim wsPaste As Excel.Worksheet
    Dim rngPaste As Excel.Range
    Dim xlsApp As Excel.Application
    xlsApp = New Excel.Application
    wbCopy = xlsApp.Workbooks.Open("C:\Windows\rta2.xlsx") 
    wsCopy = wbCopy.Worksheets(sheetname)
    rngCopy = wsCopy.Range("A7:O9")
    Dim addr As Object
    addr = ExcelSheet.Cells(r, c).Address(False, False)
    rngPaste = ExcelSheet.Range(addr) 
    rngCopy.Copy()
    rngPaste.PasteSpecial(Excel.XlPasteType.xlPasteAll, Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,false,false)
    ExcelSheet.Cells(r + 2, c + 4) = "from " & dt1 & " to " & dt2
    Set wbCopy = Nothing
    Set wsCopy = Nothing
    Set rngCopy = Nothing
    Set wbPaste = Nothing
    Set wsPaste = Nothing
    Set rngPaste = Nothing
    ExcelApp.Quit
   End sub
谢谢