Export grid to excel with strange buttons/rectangles

1 posts, 0 answers
  1. Piotr
    Piotr avatar
    1 posts
    Member since:
    Jul 2014

    Posted 08 Nov 2017 Link to this post

    Hi, I Have a problem with grid. I'm exporting to excel data from my grid and next in excel I see strange buttons/rectangles.

    I don't know how to remove these using settings in export to excel.

    Can u help me with this? How to remove this buttons..

    I think this problem is because in headers I have filters... But when I set rgProjectList.MasterTableView.AllowFilteringByColumn = false still I have this "buttons"

    Here is how I m doing export (rgProjectList is my grid.):

     

    private void HandleExporting()
            {
                hlExportToExcel.NavigateUrl = this.Page.Request.Url.AbsolutePath + String.Format("?{3}={0}&{1}={2}&CurrentPage={5}&PageSize={6}{4}&Export", this.FilteringManager.ViewId.ToString(), ProjectListWeb.ActionQueryParameterName, ProjectListWeb.ExportExcelActionName, ProjectExtendedPropertiesFilteringManager.QueryStringViewParameterName, IsReportView ? "&ReportView=1" : "", GridCurrentPage, GridPageSize);
                hlExportToExcel.Target = "_blank";
                hlExportToCsv.NavigateUrl = this.Page.Request.Url.AbsolutePath + String.Format("?{3}={0}&{1}={2}&CurrentPage={5}&PageSize={6}{4}&Export", this.FilteringManager.ViewId.ToString(), ProjectListWeb.ActionQueryParameterName, ProjectListWeb.ExportCsvActionName, ProjectExtendedPropertiesFilteringManager.QueryStringViewParameterName, IsReportView ? "&ReportView=1" : "", GridCurrentPage, GridPageSize);
                hlExportToCsv.Target = "_blank";
                rgProjectList.ExportSettings.ExportOnlyData = false;
                rgProjectList.ExportSettings.FileName = "ProjectsList";
                rgProjectList.ExportSettings.IgnorePaging = true;
                rgProjectList.ExportSettings.Csv.EncloseDataWithQuotes = true;

                if (this.isExporting)
                {
                    rgProjectList.ExportCellFormatting += rgProjectList_ExportCellFormatting;
                    rgProjectList.MasterTableView.AllowFilteringByColumn = false;
                    rgProjectList.CurrentPageIndex = rgProjectList.MasterTableView.CurrentPageIndex = GridCurrentPage;
                    rgProjectList.PageSize = rgProjectList.MasterTableView.PageSize = GridPageSize;

                    if (rgProjectList.MasterTableView.Columns.Count > 3)
                    {
                        HideColumnsBeforeExport();
                        GridBoundColumn boundColumn;
                        boundColumn = new GridBoundColumn();
                        boundColumn.DataField = "Status";
                        boundColumn.HeaderText = "Status";
                        boundColumn.UniqueName = "Status";
                        GridBoundColumn boundColumnWT;
                        boundColumnWT = new GridBoundColumn();
                        boundColumnWT.DataField = "VPProjectEndTimeIndexExport";
                        boundColumnWT.HeaderText = "Wskaźnik terminu";
                        boundColumnWT.UniqueName = "VPProjectEndTimeIndexExport";
                        
                        rgProjectList.MasterTableView.Columns.Insert(0, boundColumn);
                        rgProjectList.MasterTableView.Columns.Add(boundColumnWT);

                    }
                    rgProjectList.MasterTableView.AllowSorting = false;
                    rgProjectList.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                    rgProjectList.MasterTableView.AllowPaging = false;
                    rgProjectList.MasterTableView.AllowCustomPaging = false;                
                    rgProjectList.MasterTableView.ExportToExcel();
                }
                if (this.isExportingCsv)
                {
                    this.CsvExportManager = new FlexiCsvExportManager();
                    this.CsvExportManager.SetExportSettings(rgProjectList, GridCurrentPage, GridPageSize);
                }
            }

Back to Top