【问题标题】:How to save blob files in excel cells如何在excel单元格中保存blob文件
【发布时间】:2013-01-18 17:12:42
【问题描述】:

我的表格由存储账单的列(“文件为 pdf”)组成。

我的问题是我想将该表导出到 Excel 表。

有可能吗?

到目前为止,我尝试过这个..

 Dim xapp As New Microsoft.Office.Interop.Excel.Application
    Dim wb As Workbook = xapp.Workbooks.Add
    Dim ws As Worksheet = wb.Worksheets(1)
    ws.Activate()

    'Fill header of the sheet----------------------------------

    For i As Integer = 1 To dgvcustomer.Columns.Count
        ws.Cells(1, i) = dgvcustomer.Columns(i - 1).HeaderText
    Next

    'End header------------------------------------------------

    Dim Dgrow, Dgcell, Dgcol As Integer
    Dgrow = 1
    Dgcell = 1

    'Fill Sheet -----------------------------------------------------------------------

    While (Dgrow <= dgvcustomer.Rows.Count)
        Dgcol = 1
        While (Dgcol <= ws.UsedRange.Columns().Count)
            ws.Cells(Dgrow + 1, Dgcol).value = dgvcustomer.Rows(Dgrow - 1).Cells(ws.Cells(1, Dgcol).value).Value
            Dgcol += 1
        End While
        Dgrow += 1
    End While

    'End fill sheet--------------------------------------------------------------------

    wb.SaveAs(dlgSaveFile.FileName)
    wb.Close()
    xapp.Quit()

此代码适用于非 blob 数据类型列,但对于 blob 会引发异常。

【问题讨论】:

    标签: mysql sql vb.net oracle


    【解决方案1】:

    没有。 Excel 不支持将数据块存储在工作表的单元格中。

    您可能应该将这些 PDF 分别导出为单独的文件,并在导出的工作表中指定文件名。

    【讨论】:

    • 没有可能满足您的需求。 (例如,您可以将整个表保存在 SQL 转储文件中,但这不是人类可读的格式。)
    猜你喜欢
    • 2016-12-29
    • 2013-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多