数据表中的电子表格

发布于 2024-08-09 03:03:15 字数 416 浏览 5 评论 0原文

在我的应用程序中,我从 FTP 下载电子表格,将从电子表格读取的数据移动到数据表,并根据某些条件通过电子邮件发送新电子表格(包含第一个电子表格中的某些行)。

我的问题是创建将邮寄的电子表格。我似乎无法弄清楚如何将数据表中的行(最初来自下载的电子表格)添加到要邮寄的电子表格中。

DS.Tables(0).Rows.Add(ObjSheet.Range(workTable.Rows(i)) - 1)

这是我目前所拥有的,但它不起作用。 workTable 是电子表格中的行被复制到的数据表。 DS 是我将特定选择的行放入其中的数据集。 我非常确定可以通过消除 DataTable 或 DataSet 来简化数据流。

为了消除任何混乱,我使用 VB2005 - 希望我可以使用 2008,LINQ 简化了很多......

In my app, I'm downloading a spreadsheet from FTP, moving the data read from the spreadsheet to a DataTable, and, depending on certain conditions, emailing a new spreadsheet (one that contains certain rows from the 1st spreadsheet).

My problem is creating the spreadsheet that will be mailed. I can't seem to work out how to add the row from the DataTable (originally from the spreadsheet that was downloaded) into the spreadsheet that's going to be mailed.

DS.Tables(0).Rows.Add(ObjSheet.Range(workTable.Rows(i)) - 1)

Is what I've got at the moment, but it's not working. workTable is the DataTable where the rows from the spreadsheet were copied to. DS is the DataSet where I'm putting the rows from the specific selection.
I'm pretty sure I can simplify the flow of data by eliminating either the DataTable or the DataSet.

To eliminate any confusion, I'm using VB2005 - Wish I could use 2008 for this, LINQ simplifies so much...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红玫瑰 2024-08-16 03:03:15

SpreadsheetGear for .NET 可以帮助您做到这一点。

请参阅实时 ASP.NET (C# 和 VB)“Excel 到 Datagrid”示例此处< /a>.还有更多示例 - 其中一些可能有用 - 此处

免责声明:我拥有 SpreadsheetGear LLC

SpreadsheetGear for .NET can help you do this.

See the live ASP.NET (C# & VB) "Excel to Datagrid" samples here. There are more samples - some of which might prove useful - here.

Disclaimer: I own SpreadsheetGear LLC

千柳 2024-08-16 03:03:15

答案之一可能是不要使用 Office 进行编程 - 如果您可以使用 Office 2007 文件格式(并且考虑到 Office 兼容包的存在,没有根本原因表明您不应该使用 Office,尽管在特定环境中可能会出现问题)那么您可以使用.NET代码、System.IO.Packaging和Open XML Format SDK 1.0 - 即 .NET 3.0,它只是库,因此可以在 VS2005 中使用。

更务实的是,不要那么热衷于(至少在第一次)取消中间步骤——这是我需要定期提醒自己的。

如果您从以下步骤开始:

1)从源加载数据
2)处理源数据
3) 将结果写入目标

然后您将能够在步骤 1 和 2 中证明您拥有所需的内容,并且步骤 3 变得更易于管理,因为您只是尝试将已知数据从应用程序移动到文件。

嗯,这更多的是“想法”而不是“答案”——但我希望它有帮助。

One of the answers may be to not program with office - if you can use the Office 2007 file formats (and given the existence of the Office Compatability pack there's no fundamental reason why you shouldn't although there may be issues within a specific environment) then you can use .NET code, System.IO.Packaging and the Open XML Format SDK 1.0 - that's .NET 3.0 which is just libraries and therefore useable from VS2005.

More pragmatically, don't be so keen (at least in the first instance) to do away with the intermediate steps - something I need to remind myself at regular intervals.

If you start with the following:

1) Load the data from the source
2) Process the data from the source
3) Write the result out to the destination

Then you'll be able to demonstrate at steps 1 and 2 that you have what you want, and step 3 becomes more manageable in that you're just trying to move known data from app to file.

Hmm, that's more "thoughts" than "answer" - but I hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文