11import { ___JSE_XLSX___File , ___JSE_XLSX___FileContent , ___JSE_XLSX___Node } from "../api/xlsx" ;
22import {
3- Extension_Rels ,
4- Extension_Xml , PartName_DocProps_App , PartName_DocProps_Core , PartName_DocProps_Custom , PartName_Xl_SharedStrings ,
5- PartName_Xl_Sheet , PartName_Xl_Styles ,
6- PartName_Xl_Theme ,
7- PartName_Xl_Workbook ,
8- Xmlns_Types
3+ EXTENSION_RELS_SCHEMA ,
4+ EXTENSION_XML_SCHEMA ,
5+ PART_NAME_DOC_PROPS_APP ,
6+ PART_NAME_DOC_PROPS_CORE ,
7+ PART_NAME_DOC_PROPS_CUSTOM ,
8+ PART_NAME_XL_SHARED_STRINGS ,
9+ PART_NAME_XL_WORKSHEET ,
10+ PART_NAME_XL_STYLES ,
11+ PART_NAME_XL_THEME ,
12+ PART_NAME_XL_WORKBOOK ,
13+ XMLNS_CONTENT_TYPES ,
14+ DEFAULT_XML_VERSION , ENCODING_UTF_8 , DEFAULT_STAND_ALONE
915} from "../api/Internals" ;
1016import { JSESheet , JSExcel } from "../Types" ;
17+ import { DEFAULT_FILE_EXTENSION } from "../api/constants" ;
1118
1219const fileProps : any = {
1320 name : "[Content_Types]" ,
14- extension : ".xml" ,
15- version : "1.0" ,
16- encoding : "UTF-8" ,
17- standalone : true ,
21+ extension : DEFAULT_FILE_EXTENSION ,
22+ version : DEFAULT_XML_VERSION ,
23+ encoding : ENCODING_UTF_8 ,
24+ standalone : DEFAULT_STAND_ALONE ,
1825 nodes : {
1926 Types : "Types" ,
2027 Default : "Default" ,
@@ -48,22 +55,22 @@ function getContentTypeNodes(excel: JSExcel): ___JSE_XLSX___FileContent {
4855 } ,
4956 content : {
5057 name : fileProps . nodes . Types ,
51- values : [ { key : fileProps . keys . xmlns , value : Xmlns_Types } ] ,
58+ values : [ { key : fileProps . keys . xmlns , value : XMLNS_CONTENT_TYPES } ] ,
5259 content : [
5360 {
5461 name : fileProps . nodes . Default ,
5562 values :
5663 [
5764 { key : fileProps . keys . Extension , value : fileProps . values . rels } ,
58- { key : fileProps . keys . ContentType , value : Extension_Rels }
65+ { key : fileProps . keys . ContentType , value : EXTENSION_RELS_SCHEMA }
5966 ]
6067 } ,
6168 {
6269 name : fileProps . nodes . Default ,
6370 values :
6471 [
6572 { key : fileProps . keys . Extension , value : fileProps . values . xml } ,
66- { key : fileProps . keys . ContentType , value : Extension_Xml }
73+ { key : fileProps . keys . ContentType , value : EXTENSION_XML_SCHEMA }
6774 ]
6875 } ,
6976 //xl folder contents
@@ -73,7 +80,7 @@ function getContentTypeNodes(excel: JSExcel): ___JSE_XLSX___FileContent {
7380 values :
7481 [
7582 { key : fileProps . keys . PartName , value : fileProps . values . PartName_xml } ,
76- { key : fileProps . keys . ContentType , value : PartName_Xl_Workbook }
83+ { key : fileProps . keys . ContentType , value : PART_NAME_XL_WORKBOOK }
7784 ]
7885 } ,
7986 ...getWorkSheetsOverrides ( excel ) ,
@@ -93,7 +100,7 @@ function getWorkSheetsOverrides(excel: JSExcel): Array<___JSE_XLSX___Node> {
93100 name : fileProps . nodes . Override ,
94101 values : [
95102 { key : fileProps . keys . PartName , value : `${ partNameOverride } ${ sheet . name } ${ fileProps . extension } ` } ,
96- { key : fileProps . keys . ContentType , value : PartName_Xl_Sheet }
103+ { key : fileProps . keys . ContentType , value : PART_NAME_XL_WORKSHEET }
97104 ]
98105 } ) ) ;
99106}
@@ -106,7 +113,7 @@ function getThemesOverrides(excel: JSExcel): Array<___JSE_XLSX___Node> {
106113 name : fileProps . nodes . Override ,
107114 values : [
108115 { key : fileProps . keys . PartName , value : `${ partNameOverride } theme1${ fileProps . extension } ` } ,
109- { key : fileProps . keys . ContentType , value : PartName_Xl_Theme }
116+ { key : fileProps . keys . ContentType , value : PART_NAME_XL_THEME }
110117 ]
111118 } ] ;
112119}
@@ -119,7 +126,7 @@ function getStylesOverrides(excel: JSExcel): Array<___JSE_XLSX___Node> {
119126 name : fileProps . nodes . Override ,
120127 values : [
121128 { key : fileProps . keys . PartName , value : `${ partNameOverride } ${ fileProps . extension } ` } ,
122- { key : fileProps . keys . ContentType , value : PartName_Xl_Styles }
129+ { key : fileProps . keys . ContentType , value : PART_NAME_XL_STYLES }
123130 ]
124131 } ] ;
125132}
@@ -132,7 +139,7 @@ function getSharedStringsOverrides(excel: JSExcel): Array<___JSE_XLSX___Node> {
132139 name : fileProps . nodes . Override ,
133140 values : [
134141 { key : fileProps . keys . PartName , value : `${ partNameOverride } ${ fileProps . extension } ` } ,
135- { key : fileProps . keys . ContentType , value : PartName_Xl_SharedStrings }
142+ { key : fileProps . keys . ContentType , value : PART_NAME_XL_SHARED_STRINGS }
136143 ]
137144 } ] ;
138145}
@@ -145,14 +152,14 @@ function getPropsOverrides(excel: JSExcel): Array<___JSE_XLSX___Node> {
145152 name : fileProps . nodes . Override ,
146153 values : [
147154 { key : fileProps . keys . PartName , value : `${ partNameOverride } core${ fileProps . extension } ` } ,
148- { key : fileProps . keys . ContentType , value : PartName_DocProps_Core }
155+ { key : fileProps . keys . ContentType , value : PART_NAME_DOC_PROPS_CORE }
149156 ]
150157 } ,
151158 {
152159 name : fileProps . nodes . Override ,
153160 values : [
154161 { key : fileProps . keys . PartName , value : `${ partNameOverride } app${ fileProps . extension } ` } ,
155- { key : fileProps . keys . ContentType , value : PartName_DocProps_App }
162+ { key : fileProps . keys . ContentType , value : PART_NAME_DOC_PROPS_APP }
156163 ]
157164 } ,
158165 // ...getCustomPropsOverrider(excel) TODO: Implement when doc props interface is available and only custom props are provided
@@ -168,7 +175,7 @@ function getCustomPropsOverrider(excel: JSExcel): ___JSE_XLSX___Node {
168175 name : fileProps . nodes . Override ,
169176 values : [
170177 { key : fileProps . keys . PartName , value : `${ partNameOverride } ${ fileProps . extension } ` } ,
171- { key : fileProps . keys . ContentType , value : PartName_DocProps_Custom }
178+ { key : fileProps . keys . ContentType , value : PART_NAME_DOC_PROPS_CUSTOM }
172179 ]
173180 } ;
174181}
0 commit comments