We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Column width problem when export pictorial columns to Excel

How to auto-fit the column width based on all the contents of the column?

As the screenshot shown, the length of the column header of Column A (i.e. the text: Employee Image) is greater than that of the pictures in the column.

I tried making the column width to fit the column header, however, no solutions found in existing properties.


The effect I want:



1 Reply

RR Rajapandi Ravi Syncfusion Team April 7, 2023 12:00 PM UTC

Hi techlandandyzhang,


Greetings from Syncfusion support


You can adjust the width in the image property of the exportQueryCellInfo event argument. Please refer the below code example and sample for more information.


 

exportQueryCellInfo(args: ExcelQueryCellInfoEventArgs): void {

        if (args.column.headerText === 'Employee Image') {

            if ((args as any).name === 'excelQueryCellInfo') {

                args.image = { height: 110, base64: (args as any).data.EmployeeImage, width: 110 };

            } else {

                args.image = { base64: (args as any).data.EmployeeImage };

            }

        }

   }


Sample: https://stackblitz.com/edit/angular-81vfuy?file=src%2Fapp.component.ts,src%2Fapp.component.html


Regards,

Rajapandi R


Loader.
Live Chat Icon For mobile
Up arrow icon