Help with exporting data from multiple FlexGrid controls in ASP.NRET MVC App

Posted by: Victor.m.charles.civ on 7 September 2019, 11:01 am EST

  • Posted 7 September 2019, 11:01 am EST

    Hello,

    How do I modify the code below from a Windows App to export data from multiple FlexGrids in one PDF in my ASP.NET MVC App.?

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
    If ComboBox4.SelectedIndex = 0 Then
    C1.Win.C1TrueDBGrid.LineStyleEnum.None
    Dim doc As New C1.C1Preview.C1PrintDocument()
    doc.PageLayout.PageSettings.Landscape = True
    doc.Body.Children.Add(New C1.C1Preview.RenderText(vbLf & vbLf & "AOP-6"))
    doc.Body.Children.Add(New C1.C1Preview.RenderC1Printable(C1AOP5))
    doc.Body.Children.Add(New C1.C1Preview.RenderText(vbLf & vbLf & "AOP-8"))
    doc.Body.Children.Add(New C1.C1Preview.RenderC1Printable(C1AOP8))
    doc.Body.Children.Add(New C1.C1Preview.RenderText(vbLf & vbLf & "AOP-29"))
    doc.Body.Children.Add(New C1.C1Preview.RenderC1Printable(C1AOP29))
    doc.Body.Children.Add(New C1.C1Preview.RenderText(vbLf & vbLf & "AOP-40"))
    doc.Body.Children.Add(New C1.C1Preview.RenderC1Printable(C1AOP40))
    doc.Export("C:\TestFiles\TestFiles.pdf", True)
    End If
    End Sub
    Thanks,

    Victor
  • Replied 8 September 2019, 10:29 pm EST

    Hi Victor,
    The Multiple FlexGrid can be render in single PDF and can be exported.

    document.getElementById('btnExport').addEventListener('click', () => {
    let doc = new wijmo.pdf.PdfDocument({
    ended: (s, args) => wijmo.pdf.saveBlob(args.blob, 'sample.pdf'),
    pageSettings: {
    margins: {
    top: 20,
    bottom: 20
    },
    layout: 'Landscape'
    },
    header: {
    declarative: {
    text: '\tHeader',
    font: {
    family: 'helvetica',
    size: 16
    }
    }
    },
    footer: {
    declarative: {
    text: '\t&[Page]/&[Pages]',
    font: {
    family: 'helvetica',
    size: 16
    }
    }
    }
    });


    var grids = [
    wijmo.Control.getControl("#grid1"),
    wijmo.Control.getControl("#grid2"),];
    grids.forEach((grid, index) => {
    drawSheet(grid, doc);
    });
    doc.end();

    });


    function drawSheet(grid, doc) {
    let headerFont = new wijmo.pdf.PdfFont();
    headerFont.size = 20;
    headerFont.weight = 'bold';
    wijmo.grid.pdf.FlexGridPdfConverter.draw(grid, doc, null, null, {
    styles: {
    headerCellStyle: {
    backgroundColor: '#eaeaea'
    }
    }
    });
    doc.moveDown();
    doc.moveDown();
    }


    Hope it helps!

    Regards,
    Manish Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels