使用多个 Ultra Win 网格制作 Excel 工作表(UltraGridExcelExport)

发布于 2024-11-08 19:21:49 字数 279 浏览 0 评论 0原文

亲爱的所有朋友 我有一个窗口窗体,其中有 5 个 Infragistics Ultra 网格网格。我想将所有网格导出到 Excel 文件。现在问题就是这样。需要表中所示的所有 5 个网格。所以请帮忙解决。

目前,我使用 Infragistics Inbuild 方法仅将一个网格导出到 Excel,

   UltraGridExport.Export(UltraGrid,FileName)

建议我在一张表中导出多个网格。

感谢大家。

Dear All Friends
I Have One Window Form Which Have 5 Grid Of Infragistics Ultra Grid. I Want To Export All Grid TO Excel File. Now Problem Is That. In Need All 5 Grids In On Sheet As Shown As Form. So Please Help To Solve.

Currently I Export Only One Grid To Excel Using Infragistics Inbuild Method

   UltraGridExport.Export(UltraGrid,FileName)

Suggest Me With Multiple Grid Export In One Sheet.

Thank To All.

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

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

发布评论

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

评论(2

飞烟轻若梦 2024-11-15 19:21:49

将结果导出到工作簿的多个工作表中怎么样?

创建一个工作簿,然后为每个网格在工作簿上创建一个工作表,然后将网格导出到工作表。

public static void ExportToExcel<T>(this IEnumerable<T> grids, string filename)
    where T : UltraGrid
{
    Workbook workbook = new Workbook();
    UltraGridExcelExporter exporter = new UltraGridExcelExporter();

    foreach (T g in grids)
    {
        Worksheet sheet = workbook.Worksheets.Add(g.Name);
        exporter.Export(g.GridControl, sheet);
    }

    workbook.Save(filename);
}

How about exporting the results into multiple sheets on the workbook?

Create a workbook and then for each grid create a worksheet on the workbook and then export the grid to the worksheet.

public static void ExportToExcel<T>(this IEnumerable<T> grids, string filename)
    where T : UltraGrid
{
    Workbook workbook = new Workbook();
    UltraGridExcelExporter exporter = new UltraGridExcelExporter();

    foreach (T g in grids)
    {
        Worksheet sheet = workbook.Worksheets.Add(g.Name);
        exporter.Export(g.GridControl, sheet);
    }

    workbook.Save(filename);
}
夕色琉璃 2024-11-15 19:21:49
  string StrFile = Application.StartupPath + "\\EmpLevDetView.xls";
                    Workbook WB = new Workbook();
                    WB.Worksheets.Add("Detail");
                    ExcelExport.Export(UltGrdDet, WB.Worksheets["Detail"], 0, 0);
                    WB.Worksheets.Add("Summary");
                    ExcelExport.Export(UltGrdSum, WB.Worksheets["Summary"], 0, 0);
                    BIFF8Writer.WriteWorkbookToFile(WB, StrFile);
                    System.Diagnostics.Procesenter code heres.Start(StrFile);
  string StrFile = Application.StartupPath + "\\EmpLevDetView.xls";
                    Workbook WB = new Workbook();
                    WB.Worksheets.Add("Detail");
                    ExcelExport.Export(UltGrdDet, WB.Worksheets["Detail"], 0, 0);
                    WB.Worksheets.Add("Summary");
                    ExcelExport.Export(UltGrdSum, WB.Worksheets["Summary"], 0, 0);
                    BIFF8Writer.WriteWorkbookToFile(WB, StrFile);
                    System.Diagnostics.Procesenter code heres.Start(StrFile);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文