Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:15:36+00:00 2026-06-08T03:15:36+00:00

I have created a spread sheet (Example for MSDN) and now I want to

  • 0

I have created a spread sheet (Example for MSDN) and now I want to populate data from a dataset to this sheet. Once the data is populated than I want to draw chart on the basis of available data. I dont want to use Pivot Table, I just want to draw chart whatever data is comming from dataset.I have never worked with spreadsheets before and can’t find a right example to get some help from.
I have two Questions here

  1. How to populate data in SpreadSheet from dataset
  2. How to draw chart (Any chart example) on the basis of available data

Anyone’s help will really be appriciated.

Following is my code snippet

Public void CreateSpreadSheet()
{
    DataSet dataSet = GetDatasetForSpreadSheetChart();
    int noOfRows = dataSet.Tables["SpreadSheetTestTable"].Rows.Count;
    int noOfColumns = dataSet.Tables["SpreadSheetTestTable"].Columns.Count;

    // Create a spreadsheet document by supplying the filepath.
    SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create(filePath,SpreadsheetDocumentType.Workbook);

    // Add a WorkbookPart to the document.
    WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
    workbookpart.Workbook = new Workbook();

    // Add a WorksheetPart to the WorkbookPart.
    WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
    worksheetPart.Worksheet = new Worksheet(new SheetData());

    // Add Sheets to the Workbook.
    Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.
    AppendChild<Sheets>(new Sheets());

    // Append a new worksheet and associate it with the workbook.
    Sheet sheet = new Sheet()
    {
        Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),SheetId = 1,Name = "mySheet"
    };

    sheets.Append(sheet);

    // Get data from dataset and insert it in spreadsheet
    SheetData sheetData = sheet.GetFirstChild<SheetData>();
    for (int c = 0; c < noOfColumns; c++)
    {
       string headerName = dataSet.Tables["SpreadSheetTestTable"].Columns[c].ToString();
    }

    workbookpart.Workbook.Save();

    // Close the document.
    spreadsheetDocument.Close();
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:15:39+00:00Added an answer on June 8, 2026 at 3:15 am

    I have found a very good solution for this scenario. Table in Excel can be drawn from the following link
    http://www.nitrix-reloaded.com/2010/09/26/creating-excel-files-from-dataset-using-openxml-20-c-sharp/

    and than by using http://spreadsheetlight.com/ Libraries any type of chart/graph can be drawn in Excel.

    Changes can be made according to the scenario. Such as supplying starting and ending cell values for chart creation etc. In my scenario I have worked with run time values where I am not aware of what and how many columns are there in my Excel table. I can provide the code snippet of my scenario, if anyone needs it.

    Regards!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a nice scientific calculator and now want to save inputs and
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I have created a script that analyzes a set of raw data and converts
I have an excel spread sheet (well, hundreds of them) which I need importing
I have created a simple web page in Photoshop and want to use it
I'm trying to export data from my models to an excel spreadsheet. I have
I have an Excel (xls) template with example data. I need to prepare an
I have 3 sets of tabular data I want to display with a JavaScript
I have data that follows this kind of patten: ID Name1 Name2 Name3 Name4
I have created a library with a project name of GAS, in a spreadsheet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.