多个excel表到同一张表?

时间:2016-05-31 21:51:17

标签: c# excel

C#初学者!通常当我构建一个表(在VS中工作)时,我将每个表导出到它自己的excel表。为了减少构建时间和提高我的技能,如何将多个表输出到同一张表?我知道它的核心是调用默认单元格,但我无法正确理解语法,任何帮助都会受到赞赏。

谢谢!

我必须与之合作: 只是我每张表一个表的基础构建,如下所示:

region Product

                using (CsvFileWriter writerSupplier = new CsvFileWriter(outputDir + @"\Product.csv"))
                {
                    FulfillmentEntities db = new FulfillmentEntities();
                    db.CommandTimeout = 36000;
                    Worker.ReportProgress(100, "Creating Product Report");
                    Worker.ReportProgress(100, "Setting Product Counts");


                    Worker.ReportProgress(100, "Building Report");

                    CsvRow HeaderRow = new CsvRow();
                    HeaderRow.Add(String.Format("{0}", "A"));
                    HeaderRow.Add(String.Format("{0}", "B")); writerSupplier.WriteRow(HeaderRow);


                    IEnumerable<Field_Master> hits = db.ExecuteStoreQuery<Field_Master>
                    (@"INSERT SQL query")

                    foreach (var x in hits)
                    {
                        CsvRow row;

                        row = new CsvRow();
                        row.Add(String.Format("{0}", x.A));
                        row.Add(String.Format("{0}", x.B));                            writerSupplier.WriteRow(row);
                    }
                    writerSupplier.Close();
                    Worker.ReportProgress(100, "Product Report Complete");
                }
                #endregion

0 个答案:

没有答案