Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Hello,

I want my Excel export to have custom colours, borders, text wrapping and vertical alignment, but only the colours, font style and curstom borders are applied.

if (args.Item.Id == "sfGrid_excelexport")

            {

                ExcelExportProperties ExportProperties = new ExcelExportProperties();

                ExportProperties.FileName = $"ApplicationList_{DateTime.Now.ToString(GlobalConstants.DATE_FORMAT_DELETED_FILE)}.xlsx";

                ExportProperties.IncludeTemplateColumn = true;

                ExportProperties.Columns = this.SetGridColumnsForExport();

                ExcelTheme Theme = new ExcelTheme();

                Border border = new Border();

                border.LineStyle = LineStyle.Thin;

                border.Color = "#000000";

                ExcelStyle HeaderThemeStyle = new ExcelStyle()

                {

                    BackColor = "#00BCD4",

                    FontSize = 12,

                    Bold = true,

                    FontColor = "#FFFFFF",

                    Borders = border,

                    WrapText = true,

                    VAlign = ExcelVerticalAlign.Top

                };


                ExcelStyle RecordThemeStyle = new ExcelStyle()

                {

                    Borders = border,

                    WrapText = true,

                    VAlign = ExcelVerticalAlign.Top

                };

                Theme.Header = HeaderThemeStyle;

                Theme.Record = RecordThemeStyle;


                ExportProperties.Theme = Theme;

                await this.sfGrid.ExportToExcelAsync(ExportProperties);

            }

Here is the  SetGridColumnsForExport() method:

 private List<GridColumn> SetGridColumnsForExport()

        {

            List<GridColumn> ExportColumns = new List<GridColumn>();


            ExportColumns.Add(new GridColumn() { Field = "ProviderOwner", HeaderText = "Provider", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "PoviderBulstat", HeaderText = "Bulstat", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "LocationCorrespondence.LocationName", HeaderText ="Location", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "ProviderAddressCorrespondence", HeaderText = "Contact", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "TypeApplication", HeaderText = "Type", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "ApplicationStatus", HeaderText = "Status", TextAlign = TextAlign.Left });

            ExportColumns.Add(new GridColumn() { Field = "LicenceNumber", HeaderText = "Licence", TextAlign = TextAlign.Left });


            return ExportColumns;

        }