File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -220,18 +220,29 @@ async function convertJsonToCommonStyledExcel(data) {
220220 const endCol = startCol + ( cell . colspan || 1 ) - 1 ;
221221
222222 worksheet . mergeCells ( startRow , startCol , endRow , endCol ) ;
223-
224- colIndex += cell . colspan || 1 ;
223+ colIndex += ( cell . colspan || 1 ) ;
224+ }
225+ else if ( cell . dropdown ) {
226+ const formulae = [ `"${ cell . dropdown . join ( "," ) } "` ] ;
227+ worksheet . getCell ( rowIndex + 1 , colIndex ) . dataValidation = {
228+ type : 'list' ,
229+ allowBlank : false ,
230+ formulae : formulae ,
231+ showErrorMessage : true ,
232+ errorTitle : 'Invalid Selection' ,
233+ error : 'Please select a value from the dropdown' ,
234+ } ;
235+ colIndex ++ ;
225236 } else {
226237 colIndex ++ ;
227238 }
228239 } ) ;
229240 } ) ;
230241 worksheet . columns . forEach ( column => {
231- column . width = 20 ; // Set a default width
242+ column . width = column . width ? column . width : 20 ; // Set a default width
232243 } ) ;
233244 }
234- const buffer = await workbook . xlsx . writeBuffer ( )
245+ const buffer = await workbook . xlsx . writeBuffer ( ) ;
235246 return buffer
236247}
237248
You can’t perform that action at this time.
0 commit comments