以编程方式更新Excel文档 [英] Updating an excel document programmatically

查看:78
本文介绍了以编程方式更新Excel文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先是上下文,我是软件开发公司的自动化团队的招聘人员,所以我帮助开发我们日常生活中的自动测试程序。



我的线路经理已经生成了一个Excel文档,用于介绍测试环境的结果。我们的测试运行在Hyper-V服务器上的虚拟PC上。



我想能够使用每个测试环境的测试结果来更新这个excel文档,但我不知道我应该怎么做。每个虚拟PC都运行一个自动化程序(C#.NET 4.0),目前将测试日志和结果文件复制到我们的构建机器上的一个共享文件夹中,每个人都可以访问



所以我希望自动化程序运行测试,然后当它完成后,我希望它使用测试结果写入excel文档中的表。有没有人有任何经验,以编程方式修改excel文件?我还应该注意到,Excel文档将存储在远程虚拟PC上的共享文件夹中(可从测试环境访问)



该表将包含构建名称/日期,环境细节,测试类型和测试结果等。



我已经收集这些信息并将其显示在HTML文件中 - 但是每个文件都有一个单独的HTML文件测试环境。这样做的目的是使结果全部在一个位置(Excel文档将以图表的形式处理表格中的数据)。



所以真的,我需要知道的是如何从.NET程序中写入excel文件中的表。似乎有这样做的不同方法(当我在网上研究的时候发现),所以我想问stackoverflow,看看谁知道最好的方法来做这个。)

解决方案

我对EPPlus http://epplus.codeplex .com / 用于解析,编辑和创建xlsx文件。



这个问题帮助了我:从C#创建Excel(.XLS和.XLSX)文件


First for context, I am a placement student on the automation team of a software development company, so I help develop the automated test programs on our daily builds.

My line manager has produced an excel document which will be used to present the results from our test environments. Our tests run on virtual PC's on a hyper-V server.

I want to be able to update this excel document with the results of tests from each of the test environments, but I'm not sure how I should go about doing this.

Each of the virtual PC's runs an automation program (C# .NET 4.0), and currently copies the test logs and result files to a shared folder on our build machine, which is accessible by everyone.

So I want the automation program to run its tests, then when it has finished, I want it to write to the table in the excel document with the test results. Has anyone any experience with modifying excel documents programmatically? I should also note that the excel document will be stored in a shared folder on a remote virtual PC (accessible from the test environment)

The table will contain the build name/date, environment details, type of test and the test result etc.

I already collect this information and present it in HTML files - but there is a separate HTML file for each test environment. The goal of this is so that the results will all be in one place (The excel document will take care of presenting the data in the tables in the form of graphs and charts).

So really, all I need to know is how to write to a table in an excel document from a .NET program. There seems to be different ways of doing this (as I found when I researched it online), so I want to ask stackoverflow to see who knows the best way to do this).

解决方案

I use and am happy with EPPlus http://epplus.codeplex.com/ for parsing, editing and creating xlsx files.

This question had helped me out: Create Excel (.XLS and .XLSX) file from C#

这篇关于以编程方式更新Excel文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆