Grid Export excel is Occirred

Hi,may you help me? version 18.4

I haved ref OLD  article


addtend

    //Syncfusion

            services.AddSyncfusionBlazor();

            services.AddSignalR(e => {

                e.MaximumReceiveMessageSize = 65536;

            });


this code 

@page "/DepJoint"

@using BlazorApp.Data

@using BlazorApp.Models

@inject WorkListService WorkListService

@inject UserLogStateService UserLogStateService

@using Syncfusion.Blazor.Navigations


<div class="col-lg-12 control-section">

    <div class="content-wrapper">

        <div class="row">

            <SfTab CssClass="drag-drop-tab" AllowDragAndDrop="true">

                <TabItems>

                    <TabItem>

                        <ChildContent>

                            <TabHeader Text="查詢條件"></TabHeader>

                        </ChildContent>

                        <ContentTemplate>

                            <table id="tb1_Search" class="table table-dark" style="width:50% ">

                                <thead>

                                    <tr>

                                        <th>選擇:<strong>@DropVal</strong></th>

                                        <th>開始日期</th>

                                        <th>結束日期</th>

                                        <th>查詢</th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <tr>

                                        <td>

                                            <SfDropDownList TValue="string" TItem="DropItems" @bind-Value="@DropVal" DataSource="@DropItem">

                                                <DropDownListFieldSettings Value="Name"></DropDownListFieldSettings>

                                            </SfDropDownList>

                                        </td>

                                        <td>


                                            <input type="date" class="form-control" @bind="_SelectedDateF" />

                                        </td>

                                        <td>

                                            <input type="date" class="form-control" @bind="_SelectedDateB" />

                                        </td>

                                        <td>

                                            <button class="btn btn-primary" @onclick="Selection">查詢</button>

                                        </td>

                                    </tr>

                                </tbody>

                            </table>

                        </ContentTemplate>

                    </TabItem>

                    <TabItem>

                        <ChildContent>

                            <TabHeader Text="匯出功能"></TabHeader>

                        </ChildContent>

                        <ContentTemplate>

                            <SfButton Content="Print" OnClick="PrintContent"></SfButton>

                            <SfButton OnClick="ExcelExport" Content="Excel Export"></SfButton>

                            <SfButton OnClick="PdfExport" Content="Pdf Export"></SfButton>

                        </ContentTemplate>

                    </TabItem>

                </TabItems>

            </SfTab>

        </div>


    </div>

</div>




<div class="col-lg-12 control-section">

    <div class="content-wrapper">

        <div class="row">

            <SfGrid DataSource="@oGot" AllowGrouping="true" AllowSorting="true" AllowFiltering="true" AllowPaging="true" ShowColumnMenu="true" @ref="DefaultGrid" Toolbar="@(new List<string>() { "Search" })" AllowExcelExport="true" AllowPdfExport="true">

                <GridFilterSettings Type="@Syncfusion.Blazor.Grids.FilterType.CheckBox"></GridFilterSettings>

                <GridColumns>

                    <GridColumn Field=@nameof(Cim100.Id) HeaderText="序號" TextAlign="TextAlign.Right" Width="120"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.Creater) HeaderText="創立人" Width="150"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.CreateDate) HeaderText=" 建檔時間" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.Department) HeaderText="部門" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.AbnormalInformTime) HeaderText="發生時間" Width="150"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.TransferTime) HeaderText="轉交現場時間" Width="150"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.Symptoms) HeaderText="問題" Width="150"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.Tactics) HeaderText="手法" Width="150"> </GridColumn>

                    <GridColumn Field=@nameof(Cim100.Executor) HeaderText="執行人" Width="100"> </GridColumn>

                    <GridColumn Field=@nameof(Cim100.Flag) HeaderText="完成|未完成" Width="100"></GridColumn>

                    <GridColumn Field=@nameof(Cim100.Event) HeaderText="事件" Width="100"> </GridColumn>

                    <GridColumn HeaderText="圖片" TextAlign="TextAlign.Center" Width="120">

                        <Template>

                            @{

                                var Cim100 = (context as Cim100);

                                <div class="image">

                                    <img src="@Cim100.Status" asp-append-version="true" width="300px" />

                                </div>

                            }

                        </Template>

                    </GridColumn>

                </GridColumns>

            </SfGrid>

        </div>

    </div>

</div>

@code{


    private List<Cim100> oGot;

    protected override void OnInitialized()

    {

        var Tool = (new List<string>() { "Search" });

    }

    private SfGrid<Cim100> DefaultGrid;


    public async Task PdfExport()

    {

        await this.DefaultGrid.PdfExport();

    }

    public async Task ExcelExport()

    {

        ExcelExportProperties ExcelProperties = new ExcelExportProperties();

        ExcelProperties.DataSource = oGot;

        await this.DefaultGrid.ExcelExport(ExcelProperties);


    }

    public void PrintContent()

    {

        this.DefaultGrid.Print();

    }


}

@code {


    public string DropVal;


    public class DropItems

    {

        public string Name { get; set; }

        public string Code { get; set; }

    }

    List<DropItems> DropItem = new List<DropItems>

       {

        new DropItems() { Name = "電一課", Code = "電一課" },

        new DropItems() { Name = "電二課", Code = "電二課" },

        new DropItems() { Name = "電三課", Code = "電三課" },

        new DropItems() { Name = "電五課", Code = "電五課" },

        new DropItems() { Name = "觀電課", Code = "觀電課" },

        new DropItems() { Name = "電務課", Code = "電務課" },

        new DropItems() { Name = "資工課", Code = "資工課" },

    };


    public DateTime _SelectedDateF { get; set; } = DateTime.Now.AddDays(-11);

    public DateTime _SelectedDateB { get; set; } = DateTime.Now.AddDays(1);

    void Selection()

    {

        oGot = WorkListService.GetKeyIn(@DropVal, _SelectedDateF, _SelectedDateB);



    }




}




1 Reply

RN Rahul Narayanasamy Syncfusion Team August 12, 2021 01:13 PM UTC

Hi Wen, 

Greetings from Syncfusion. 

Query: Grid excel export error 

We have validated your query and checked the reported problem. We could not able to reproduce the reported problem while performing excel export operation. Find the below sample for your reference. 


We have checked the reported problem in the mentioned 18.4.*.*(18.4.0.49) version and latest version(19.2.0.55). 

If you are still facing the problem, then could you please share the below details. It will be helpful to validate and provide a better solution. 

  • Share the exception details.
  • Reproduce the reported problem in the provided sample and revert back to us.
  • How much amount data you are trying to export?
  • Share a simple reproduceable sample if possible.
 
Regards, 
Rahul 


Loader.
Up arrow icon