@@ -159,6 +159,10 @@ function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, a
159
159
if ( cell . StyleID !== undefined ) cell . ixfe = cell . StyleID ;
160
160
}
161
161
162
+ function xlml_prefix_dname ( dname ) {
163
+ return XLSLblBuiltIn . indexOf ( "_xlnm." + dname ) > - 1 ? "_xlnm." + dname : dname ;
164
+ }
165
+
162
166
function xlml_clean_comment ( comment /*:any*/ ) {
163
167
comment . t = comment . v || "" ;
164
168
comment . t = comment . t . replace ( / \r \n / g, "\n" ) . replace ( / \r / g, "\n" ) ;
@@ -366,7 +370,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
366
370
if ( ! Workbook . Names ) Workbook . Names = [ ] ;
367
371
var _NamedRange = parsexmltag ( Rn [ 0 ] ) ;
368
372
var _DefinedName /*:DefinedName*/ = ( {
369
- Name : _NamedRange . Name ,
373
+ Name : xlml_prefix_dname ( _NamedRange . Name ) ,
370
374
Ref : rc_to_a1 ( _NamedRange . RefersTo . slice ( 1 ) , { r :0 , c :0 } )
371
375
} /*:any*/ ) ;
372
376
if ( Workbook . Sheets . length > 0 ) _DefinedName . Sheet = Workbook . Sheets . length - 1 ;
@@ -956,7 +960,7 @@ function write_sty_xlml(wb, opts)/*:string*/ {
956
960
} ) ;
957
961
return writextag ( "Styles" , styles . join ( "" ) ) ;
958
962
}
959
- function write_name_xlml ( n ) { return writextag ( "NamedRange" , null , { "ss:Name" : n . Name , "ss:RefersTo" :"=" + a1_to_rc ( n . Ref , { r :0 , c :0 } ) } ) ; }
963
+ function write_name_xlml ( n ) { return writextag ( "NamedRange" , null , { "ss:Name" : n . Name . slice ( 0 , 6 ) == "_xlnm." ? n . Name . slice ( 6 ) : n . Name , "ss:RefersTo" :"=" + a1_to_rc ( n . Ref , { r :0 , c :0 } ) } ) ; }
960
964
function write_names_xlml ( wb /*::, opts*/ ) /*:string*/ {
961
965
if ( ! ( ( wb || { } ) . Workbook || { } ) . Names ) return "" ;
962
966
/*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
@@ -1209,6 +1213,8 @@ function write_ws_xlml(idx/*:number*/, opts, wb/*:Workbook*/)/*:string*/ {
1209
1213
/* WorksheetOptions */
1210
1214
o . push ( write_ws_xlml_wsopts ( ws , opts , idx , wb ) ) ;
1211
1215
1216
+ if ( ws [ "!autofilter" ] ) o . push ( '<AutoFilter x:Range="' + a1_to_rc ( fix_range ( ws [ "!autofilter" ] . ref ) , { r :0 , c :0 } ) + '" xmlns="urn:schemas-microsoft-com:office:excel"></AutoFilter>' ) ;
1217
+
1212
1218
return o . join ( "" ) ;
1213
1219
}
1214
1220
function write_xlml ( wb , opts ) /*:string*/ {
0 commit comments