Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create the excel file add the data from memory stream from to excel.

What I have tried:

I used the follwing code.

File.Create(filepath).Close();
var memory = new MemoryStream()
byte[] bytes = File.ReadAllBytes(Path.Combine(fullPath, fileName));
memory.Write(bytes, 0, bytes.Length);


it is creating the excel file but when i am trying to open, it is giving messanger "We found problem with some contents in 'filename'. Do you want to us try to recover as much as we can? If you trust the source of this workbook click Yes"
Posted
Updated 29-Nov-17 0:29am
v2

You are creating only file not excel documents. there is whole process which you need to follow , start by adding excel addins and then creating connection

see this blog-
How to create Excel file in C#[^]
 
Share this answer
 
This article How to Create Excel File Using C#[^] might help you to learn how to create excel file.
 
Share this answer
 
hi follow the link bellow,

How to create Excel file in C#[^]

Hope it helps you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900