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

  • SEARCH
  • Home
  • 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 6898057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:14:52+00:00 2026-05-27T07:14:52+00:00

I have a C# method, see code below, that generates an Excel spreadsheet using

  • 0

I have a C# method, see code below, that generates an Excel spreadsheet using EPPlus. The method takes in 3 strings, one of which is a pipe delimited string named csv that has my data in it. The data I’m using has 14 columns, and in the 14th column I have data that looks like: 103.01.06, or 01.01, or some other numeric values separated by periods. The problem I’m seeing is that if the value is 103.01.06, then EPPlus transforms that into the value -656334. Is there some way to fix this?

    private void GenerateSpreadsheet(string id, string csv, string worksheetName)
    {
        using (ExcelPackage pck = new ExcelPackage())
        {
            ExcelWorksheet ws = pck.Workbook.Worksheets.Add(worksheetName);

            ws.Cells["A1"].LoadFromText(csv, new ExcelTextFormat{Delimiter = '|'}); 

            Response.AddHeader("Content-Disposition",
                String.Format("attachment; filename={0}.xlsx", id));
            Response.ContentType =
                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            Response.BinaryWrite(pck.GetAsByteArray());
            Response.End();
        }
    }
  • 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-05-27T07:14:53+00:00Added an answer on May 27, 2026 at 7:14 am

    If you don’t specify a columns type via the Datatypes property of the ExcelTextFormat object then EPPlus assumes unknown for the column. Since you have fourteen columns and you are having trouble with data in the fourteenth column you’ll need to specify types for each prior column. Without knowing your Datatypes I’ve just listed fourteen instances of eDataTypes.String, but eDataTypes.Number etc. would also work.

    EPPlus makes a guess when assigning a type to a column.

    private void GenerateSpreadsheet(string id, string csv, string worksheetName)
    {
        using (ExcelPackage pck = new ExcelPackage())
        {
            ExcelWorksheet ws = pck.Workbook.Worksheets.Add(worksheetName);
    
            ws.Cells["A1"].LoadFromText(csv, new ExcelTextFormat { Delimiter = '|', 
                DataTypes = new eDataTypes[] { eDataTypes.String, eDataTypes.String, 
                    eDataTypes.String, eDataTypes.String, eDataTypes.String,
                    eDataTypes.String, eDataTypes.String, eDataTypes.String,
                    eDataTypes.String, eDataTypes.String, eDataTypes.String, 
                    eDataTypes.String, eDataTypes.String, eDataTypes.String } }); 
    
            Response.AddHeader("Content-Disposition",
                String.Format("attachment; filename={0}.xlsx", id));
            Response.ContentType =
                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            Response.BinaryWrite(pck.GetAsByteArray());
            Response.End();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm resizing jpegs by using the Graphics.DrawImage method (see code fragment below). Can anyone
I have a method which takes params object[] such as: void Foo(params object[] items)
I have a method in my Python code that returns a tuple - a
I have a method in .NET (C#) which returns string[][] . When using RegAsm
I've an annoying ASP.NET problem: I have a Perl script (see below), which gets
I have a WCF service which exposes a method that returns an array of
I have a little method that does some CoreGraphics drawing. Today I was using
i have a text area where i put my code and below div that
I have problem with session and query execution,please see code below. class A implements
I have problem with session and query execution, please see code below. class A

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.