在Excel中使用模板与C# [英] Using templates in excel with C#

查看:153
本文介绍了在Excel中使用模板与C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我生产我需要生成含1工作簿中的C#程序的一部分; 2不同的工作表,并且可以产生任意次数,究竟是这样做的最有效的方式第3?我已经调查使用模板虽然我不确定如何重复某些工作表,而只有一次显示等。任何帮助或建议,将不胜感激。

As part of the c# program that I am producing I need to generate 1 workbook containing; 2 different worksheets and a 3rd that could be produced any number of times, what is the most effective way of doing this? I have looked into using templates although I am unsure how to repeat certain worksheets whilst only displaying others once. Any help or advice would be appreciated.

推荐答案

一个简单的方法就是让手离开模板,例如工作簿的三个工作表。然后做它的一个副本。 ,到工作簿一样需要一个新的工作表中同时打开和重新复制工作表数3

A simple way is to make a hands off template example workbook with the three worksheets. Then make a copy of it. Open both and re-copy worksheet number 3 on to the working workbook as a new worksheet as needed.

在回应评论:

有一个.NET组件产品的一对夫妇的Excel引擎我们那里,像电子表格的齿轮或阅读Aspose细胞。但是如果你的应用程序是基于Windows窗体和凡申请是保证运行有办公室,您可以使用办公自动化。你不能合法使用Web服务器上办公自动化,但它仅仅是尽可能在Web服务器上作为客户端桌面上。我用阅读Aspose细胞和它比电子表格齿轮很容易使用和非常能干和一个小便宜,但电子表格齿轮确实也有很好的口碑。这两个组件都对如何用Excel做什么很好的文档。但是,如果您有Excel并想使用办公自动化,一定要寻找示例代码如何正确关闭从C#或vb.net擅长在网络上。有一些技巧,以得到它正确关闭。

There are a couple of excel engines in a .net component products our there like spreadsheet gear or aspose cells. But if your application is a windows form based and where the application is guaranteed to run has office you can use office automation. You can't legally use office automation on a web server, but it is just as possible on a web server as on a client desktop. I've used the aspose cells and it's very easy to work with and very capable and a little less expensive than spreadsheet gear, but spreadsheet gear does also have a good reputation. Both of those components have very good documentation on how to do anything with excel. But if you have excel and want to use office automation, be sure to look for example code on the web on how to properly close excel from c# or vb.net. There are some tricks to getting it to close properly.

这篇关于在Excel中使用模板与C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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