本文介绍了如何在C#中创建excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建excel文件,将内存流中的数据添加到excel。 我尝试过: 我使用了以下代码。
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);它正在创建excel文件,但是当我尝试打开,它给了消息我们发现'文件'中的一些内容有问题。你想我们尽可能多地恢复吗?如果你信任这个工作簿的来源,请点击是
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"
推荐答案您只创建文件而不是Excel文档。有完整的过程需要遵循,首先添加excel插件然后创建连接 看到这个博客 - 如何在C#中创建Excel文件 [ ^ ] 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#[^]
本文如何使用C#创建Excel文件 [ ^ ]可能会帮助您学习如何创建excel文件。 This article How to Create Excel File Using C#[^] might help you to learn how to create excel file.
您可以点击下面的链接, 如何在C#中创建Excel文件 [ ^ ] 希望它可以帮到你。 hi follow the link bellow, How to create Excel file in C#[^] Hope it helps you.
更多推荐
如何在C#中创建excel
发布评论