Class DocumentInfo
java.lang.Object
com.nomagic.magicreport.engine.ooxml.child.docx.DocumentInfo
Handle document information.
The DOCX template contains files in zip.
For example:
- [Content_Type].xml
- word/document.xml
- word/_rels/document.xml.rels
- word/styles.xml
- etc. When it include content from another template, the related file should be included.
The DOCX template contains files in zip.
For example:
- [Content_Type].xml
- word/document.xml
- word/_rels/document.xml.rels
- word/styles.xml
- etc. When it include content from another template, the related file should be included.
-
Field Summary
FieldsModifier and TypeFieldDescriptionList of ContentType attribute value in [Content_Type].xml that should be at most one can have the value in the fileList of Type attribute value in word/_rels/document.xml.rels that should be at most one in the file -
Constructor Summary
ConstructorsConstructorDescriptionDocumentInfo(String id, DocumentInfo mainDocInfo, String filePath) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContentTypes(com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType contentTypes) Add a DocumentContentType object to set of DocumentContentType.Get map of old id and new id to handle w:abstractNumId.Get map of child id and child DocumentInfo.Get map of child path and child id.Get content of [Content_Type].xmlSet<com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType> Get set of DocumentContentType.Get documentation content.Get map of dynamic relationship.
{dynamic relationship id, DocumentRelationship}getFile()Get document fileGet path of documentgetId()Get document idGet main documentGet content of word/numbering.xmlGet map of old id and new id to handle w:numId.Get content of word/_rels/document.xml.rels.Get map of relationship.
{relationship id, DocumentRelationship}Get map of section id and DocumentSection.Get map of static relationship.
{static relationship id, DocumentRelationship}Get content of word/styles.xmlbooleanCheck if child style has been updated or not.voidsetAbstractNumberingMap(Map<String, String> abstractNumberingMap) Set map of old id and new id from w:abstractNumId in numbering.xml.voidsetChildDocumentInfoMap(Map<String, DocumentInfo> childDocumentInfoMap) Set map of child id and child DocumentInfo.voidsetChildPathAndIDMap(Map<String, String> childPathAndIDMap) Set map of child path and child id.voidsetChildStyleIdMap(Map<String, String> childStyleIdMap) voidsetContentTypeContent(StringBuilder contentTypeContent) Set content of [Content_Type].xmlvoidsetContentTypeNameSpaceMap(Map<String, String> contentTypeNameSpaceMap) voidsetContentTypes(Set<com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType> contentTypes) Set set of DocumentContentType.voidsetDocumentBuffer(StringBuilder documentBuffer) Set documentation content.voidsetDocumentNameSpaceMap(Map<String, String> documentNameSpaceMap) voidsetDynamicRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship> dynamicRelationshipMap) Set map of dynamic relationship.voidsetFilePath(String filePath) Set path of documentvoidSet document idvoidsetMainDocInfo(DocumentInfo mainDocInfo) set main documentvoidsetNumberingContent(StringBuilder numberingContent) Set content of word/numbering.xmlvoidsetNumberingMap(Map<String, String> numberingMap) Set map of old id and new id from w:numId in numbering.xml.voidsetRelationshipContent(StringBuilder relationshipContent) Set content of word/_rels/document.xml.rels.voidsetRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> relationshipMap) Set map of relationship.voidsetSectionInfoMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection> sectionInfoMap) Set map of section id and DocumentSection.voidsetStaticRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> staticRelationshipMap) Set map of static relationship.voidsetStyleContent(StringBuilder styleContent) Set content of word/styles.xmlvoidsetUpdateChildStyleAndNumbering(boolean updateChildStyleAndNumbering) voidupateSectionChildMap(String childid, DocumentInfo childDocumentInfo) Update map of child id and child DocumentInfo.
When the engine found child template, child DocumentInfo will be created.
The child id and child DocumentInfo will be added to this map of Main DocumentInfo.
For example:
#includeSection("child.docx", "A")
child path = "child.docx"
child id = "sectionChild1"
The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
The child DocumentInfo of "child.docx" template will be created.
The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.voidupdateAbstractNumberingMap(String oldId, String newId) Add or update old id and new id from w:abstractNumIdvoidupdateChildPathAndIDMap(String childPath, String childId) Update map of child path and child id.voidupdateChildStyleIdMap(String oldStyleId, String newStyleId) voidupdateContentTypeNameSpaceMap(String key, String value) voidupdateDocumentNameSpaceMap(String key, String value) voidupdateDynamicRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship documentRelationship) Update map of dynamic relationship.voidupdateNumberingMap(String oldId, String newId) Add or update old id and new id from w:numId.voidupdateRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship relationship) Update map of relationship.voidupdateSectionInfoMap(String sectionName, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection documentSection) Update map of section id and DocumentSection.
When the engine found section of child document, DocumentSection will be created.
The sectionName and DocumentSection will be added to this map of child DocumentInfo.
For example:
#includeSection("child.docx", "A")
child path = "child.docx"
child id = "sectionChild1"
The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
The child DocumentInfo of "child.docx" template will be created.
The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.
The DocumentSection of section A will be created.
The pair of {"A", aDocumentSection} will be added to sectionInfoMap of childDocumentInfo.voidupdateStaticRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship documentRelationship) Update map of static relationship.
-
Field Details
-
reservedRelationshipType
List of Type attribute value in word/_rels/document.xml.rels that should be at most one in the file -
reservedContentType
List of ContentType attribute value in [Content_Type].xml that should be at most one can have the value in the file
-
-
Constructor Details
-
DocumentInfo
Constructor- Parameters:
id- document idmainDocInfo- main document infofilePath- file path of document
-
-
Method Details
-
getId
Get document id- Returns:
- document id
-
setId
Set document id- Parameters:
id- document id
-
getFile
Get document file- Returns:
- document file
-
getFilePath
Get path of document- Returns:
- path of document
-
setFilePath
Set path of document- Parameters:
filePath- path of document
-
getMainDocInfo
Get main document- Returns:
- main document
-
setMainDocInfo
set main document- Parameters:
mainDocInfo- document
-
getDocumentBuffer
Get documentation content.- Returns:
- documentation content
-
setDocumentBuffer
Set documentation content.- Parameters:
documentBuffer- documentation content
-
getDocumentNameSpaceMap
-
setDocumentNameSpaceMap
-
updateDocumentNameSpaceMap
-
getContentTypes
Get set of DocumentContentType. DocumentContentType contains key and value of each attribute in [Content_Type].xml- Returns:
- list of content type objects
-
setContentTypes
public void setContentTypes(Set<com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType> contentTypes) Set set of DocumentContentType.- Parameters:
contentTypes- set of DocumentContentType
-
addContentTypes
public void addContentTypes(com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType contentTypes) Add a DocumentContentType object to set of DocumentContentType.- Parameters:
contentTypes- content type object
-
getContentTypeNameSpaceMap
-
setContentTypeNameSpaceMap
-
updateContentTypeNameSpaceMap
-
getRelationshipMap
public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> getRelationshipMap()Get map of relationship.
{relationship id, DocumentRelationship}- Returns:
- map of relationship
-
setRelationshipMap
public void setRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> relationshipMap) Set map of relationship.- Parameters:
relationshipMap- map of relationship
-
updateRelationshipMap
public void updateRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship relationship) Update map of relationship.- Parameters:
id- relationship idrelationship- DocumentRelationship object
-
getStaticRelationshipMap
public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> getStaticRelationshipMap()Get map of static relationship.
{static relationship id, DocumentRelationship}- Returns:
- map of static relationship id and related DocumentRelationship object
-
setStaticRelationshipMap
public void setStaticRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> staticRelationshipMap) Set map of static relationship.- Parameters:
staticRelationshipMap- map of static relationship
-
updateStaticRelationshipMap
public void updateStaticRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship documentRelationship) Update map of static relationship.- Parameters:
id- static relationship iddocumentRelationship- DocumentRelationship object
-
getDynamicRelationshipMap
public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship> getDynamicRelationshipMap()Get map of dynamic relationship.
{dynamic relationship id, DocumentRelationship}- Returns:
- map of dynamic relationship
-
setDynamicRelationshipMap
public void setDynamicRelationshipMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship> dynamicRelationshipMap) Set map of dynamic relationship.- Parameters:
dynamicRelationshipMap- map of dynamic relationship
-
updateDynamicRelationshipMap
public void updateDynamicRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship documentRelationship) Update map of dynamic relationship.- Parameters:
id- dynamic relationship iddocumentRelationship- DocumentRelationship object
-
getChildPathAndIDMap
Get map of child path and child id.- Returns:
- map of child path and child id
-
setChildPathAndIDMap
Set map of child path and child id.- Parameters:
childPathAndIDMap- map of child path and child id
-
updateChildPathAndIDMap
Update map of child path and child id.
When the engine found child template, child id will be created.
The child template file path and child id will be added to this map.
For example:
#includeSection("child.docx", "A")
child path = "child.docx"
child id = "sectionChild1"
The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.- Parameters:
childPath- child pathchildId- child id
-
getChildDocumentInfoMap
Get map of child id and child DocumentInfo.- Returns:
- map of child id and DocumentInfo of child
-
setChildDocumentInfoMap
Set map of child id and child DocumentInfo.- Parameters:
childDocumentInfoMap- map of child id and DocumentInfo of child
-
upateSectionChildMap
Update map of child id and child DocumentInfo.
When the engine found child template, child DocumentInfo will be created.
The child id and child DocumentInfo will be added to this map of Main DocumentInfo.
For example:
#includeSection("child.docx", "A")
child path = "child.docx"
child id = "sectionChild1"
The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
The child DocumentInfo of "child.docx" template will be created.
The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.- Parameters:
childid- child template idchildDocumentInfo- child DocumentInfo
-
getSectionInfoMap
public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection> getSectionInfoMap()Get map of section id and DocumentSection.- Returns:
- map of section id and DocumentSection.
-
setSectionInfoMap
public void setSectionInfoMap(Map<String, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection> sectionInfoMap) Set map of section id and DocumentSection.- Parameters:
sectionInfoMap- map of section id and DocumentSection.
-
updateSectionInfoMap
public void updateSectionInfoMap(String sectionName, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection documentSection) Update map of section id and DocumentSection.
When the engine found section of child document, DocumentSection will be created.
The sectionName and DocumentSection will be added to this map of child DocumentInfo.
For example:
#includeSection("child.docx", "A")
child path = "child.docx"
child id = "sectionChild1"
The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
The child DocumentInfo of "child.docx" template will be created.
The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.
The DocumentSection of section A will be created.
The pair of {"A", aDocumentSection} will be added to sectionInfoMap of childDocumentInfo.- Parameters:
sectionName- section namedocumentSection- DocumentSection
-
getRelationshipContent
Get content of word/_rels/document.xml.rels.- Returns:
- content of word/_rels/document.xml.rels
-
setRelationshipContent
Set content of word/_rels/document.xml.rels.- Parameters:
relationshipContent- content of word/_rels/document.xml.rels
-
getContentTypeContent
Get content of [Content_Type].xml- Returns:
- content of [Content_Type].xml
-
setContentTypeContent
Set content of [Content_Type].xml- Parameters:
contentTypeContent- content of [Content_Type].xml
-
getStyleContent
Get content of word/styles.xml- Returns:
- content of word/styles.xml
-
setStyleContent
Set content of word/styles.xml- Parameters:
styleContent- content of word/styles.xml
-
getAbstractNumberingMap
Get map of old id and new id to handle w:abstractNumId.- Returns:
- map of abstractNumId
-
setAbstractNumberingMap
Set map of old id and new id from w:abstractNumId in numbering.xml. The w:abstractNumId of child template may duplicate to main template. So, the value should be updated- Parameters:
abstractNumberingMap- map of abstractNumId
-
updateAbstractNumberingMap
Add or update old id and new id from w:abstractNumId- Parameters:
oldId- original value id of w:abstractNumIdnewId- new value id of w:abstractNumId
-
getNumberingMap
Get map of old id and new id to handle w:numId.- Returns:
- map of w:numId
-
setNumberingMap
Set map of old id and new id from w:numId in numbering.xml. The w:numId of child template may duplicate to main template. So, the value should be updated- Parameters:
numberingMap- map of numId
-
updateNumberingMap
Add or update old id and new id from w:numId.- Parameters:
oldId- original value id of w:numIdnewId- new value id of w:numId
-
getNumberingContent
Get content of word/numbering.xml- Returns:
- content of word/numbering.xml
-
setNumberingContent
Set content of word/numbering.xml- Parameters:
numberingContent- content of word/numbering.xml
-
getChildStyleIdMap
-
setChildStyleIdMap
-
updateChildStyleIdMap
-
isUpdateChildStyleAndNumbering
public boolean isUpdateChildStyleAndNumbering()Check if child style has been updated or not. This value help us to avoid updating same style.- Returns:
- true if child style has already been updated.
-
setUpdateChildStyleAndNumbering
public void setUpdateChildStyleAndNumbering(boolean updateChildStyleAndNumbering)
-