Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active November 8, 2019 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/5f9beb5ce2a3e3c5e14fca657762b649 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/5f9beb5ce2a3e3c5e14fca657762b649 to your computer and use it in GitHub Desktop.
string connectionString = string.Format("Provider=System.Data.Sqlite;Data Source={0};Version=3;", "sqlite.db");
// Iterate over tables
foreach (TocItem i in toc)
{
// Print the table name
Console.WriteLine(i.Text);
// Extract a table content as a text
using (TextReader reader = parser.GetText(i.PageIndex.Value))
{
Console.WriteLine(reader.ReadToEnd());
}
}
// Get a list of tables
IEnumerable<TocItem> toc = parser.GetToc();
using (Parser parser = new Parser(connectionString, new LoadOptions(FileFormat.Database)))
{
// your code goes here
}
using System;
using System.Collections.Generic;
using System.IO;
using GroupDocs.Parser.Data;
using GroupDocs.Parser.Options;
string connectionString = string.Format("Provider=System.Data.Sqlite;Data Source={0};Version=3;", "sqlite.db");
// Create an instance of Parser class to extract tables from the database.
// Connection string is passed as first parameter and LoadOptions is set to Database file format.
using (Parser parser = new Parser(connectionString, new LoadOptions(FileFormat.Database)))
{
// Get a list of tables
IEnumerable<TocItem> toc = parser.GetToc();
// Iterate over tables
foreach (TocItem i in toc)
{
// Print the table name
Console.WriteLine(i.Text);
// Extract a table content as a text
using (TextReader reader = parser.GetText(i.PageIndex.Value))
{
Console.WriteLine(reader.ReadToEnd());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment