usmanazizgroupdocs
6/7/2016 - 7:14 AM

ExportMetadataAPI.vb

' For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
filePath = Common.MapSourceFilePath(filePath)

If exportType = ExportTypes.ToExcel Then
    ' path to the output file
    Dim outputPath As String = Common.MapDestinationFilePath("metadata.xlsx")

    ' export to excel
    Dim content As Byte() = ExportFacade.ExportToExcel(filePath)

    ' write data to the file
    File.WriteAllBytes(outputPath, content)
ElseIf exportType = ExportTypes.ToCVS Then
    ' path to the output file
    Dim outputPath As String = Common.MapDestinationFilePath("metadata.cvs")

    ' export to csv
    Dim content As Byte() = ExportFacade.ExportToCsv(filePath)

    ' write data to the file
    File.WriteAllBytes(outputPath, content)
Else
    ' export to DataSet
    Dim ds As DataSet = ExportFacade.ExportToDataSet(filePath)
    ' get first table
    Dim products As DataTable = ds.Tables(0)

    ' need to System.Data.DataSetExtension reference            
    Dim query As IEnumerable(Of DataRow) = From product In products.AsEnumerable()

    Console.WriteLine("Properties:")
    For Each p As DataRow In query
        Console.Write(p.Field(Of String)("Metadata property"))
        Console.Write(": ")
        Console.WriteLine(p.Field(Of String)("Value"))
    Next