docx圢åŒã®ããã¥ã¡ã³ããxlsxããŒãã«ãpptxãã¬ãŒã³ããŒã·ã§ã³ãåŠçããã¿ã¹ã¯ã¯éåžžã«ç°¡åã§ãã ãã®èšäºã§ã¯ãXSLTãšZIPã¢ãŒã«ã€ããŒã®ã¿ã䜿çšããŠããã®ãããªããã¥ã¡ã³ããè§£æãäœæãåŠçããæ¹æ³ãåŠã¶æ¹æ³ã説æããŸãã
ãªãã§ïŒ
docxã¯æãäžè¬çãªããã¥ã¡ã³ã圢åŒã§ããããããã®åœ¢åŒã§ãŠãŒã¶ãŒã«æ
å ±ãæäŸããã¿ã¹ã¯ã¯åžžã«çºçããŸãã ãã®åé¡ã®è§£æ±ºçã®1ã€-æ¢è£œã®ã©ã€ãã©ãªã䜿çšããããšã¯ãããã€ãã®çç±ã§é©åã§ã¯ãªãå ŽåããããŸãã
- ã©ã€ãã©ãªã¯åã«ååšããªãå¯èœæ§ããããŸã
- ãããžã§ã¯ãã«ã¯å¥ã®ãã©ãã¯ããã¯ã¹ã¯å¿
èŠãããŸãã
- ãã©ãããã©ãŒã ãªã©ã«ããã©ã€ãã©ãªã®å¶é
- ã©ã€ã»ã³ã¹ã®åé¡
- äœæ¥é床
ãããã£ãŠããã®èšäºã§ã¯ãdocxããã¥ã¡ã³ããæäœããããã®æãåºæ¬çãªããŒã«ã®ã¿ã䜿çšããŸãã
Docxæ§é
æåã«ãdocxããã¥ã¡ã³ããšã¯äœããçè§£ããŸãããã docxã¯ã2çš®é¡ã®ãã¡ã€ã«ãç©ççã«å«ãzipã¢ãŒã«ã€ãã§ãã
- xmlããã³
rels
æã€xmlãã¡ã€ã« - ã¡ãã£ã¢ãã¡ã€ã«ïŒç»åãªã©ïŒ
ãããŠè«ççã«-3çš®é¡ã®èŠçŽ ïŒ
- ã¿ã€ãïŒã³ã³ãã³ãã¿ã€ãïŒ-ããã¥ã¡ã³ãã§èŠã€ãã£ãã¡ãã£ã¢ãã¡ã€ã«ã®ã¿ã€ãïŒpngãªã©ïŒãšããã¥ã¡ã³ãã®äžéšã®ã¿ã€ãïŒããã¥ã¡ã³ããããããŒãªã©ïŒã®ãªã¹ãã
- ããŒãã¯ããã¥ã¡ã³ãã®äžéšã§ãããããã¥ã¡ã³ãã®å Žåã¯document.xmlã§ããããã«ã¯ãxmlããã¥ã¡ã³ããšã¡ãã£ã¢ãã¡ã€ã«ã®äž¡æ¹ãå«ãŸããŸãã
- é¢ä¿ã¯ããªã³ã¯ã®ããã¥ã¡ã³ãã®éšåïŒããšãã°ãããã¥ã¡ã³ãã®ã»ã¯ã·ã§ã³ãšããã¿ãŒã®é¢ä¿ïŒãèå¥ããå€éšéšåïŒããšãã°ããã€ããŒãªã³ã¯ïŒã¯ããã§å®çŸ©ãããŸãã
ãããã¯ã ECMA-376èŠæ Œã§è©³ãã説æãããŠããŸããOfficeOpen XML File Formatsã®äž»èŠéšåã¯5000ããŒãžã®PDFææžã§ãããããã«2000ããŒãžã®ããŒãã¹ã³ã³ãã³ãã§ãã
æå°docx
è§£ååŸã®æãç°¡åãªdocxã¯æ¬¡ã®ãšããã§ãã

ãããäœã§æ§æãããããèŠãŠã¿ãŸãããã
[Content_Types] .xml
ããã¥ã¡ã³ãã®ã«ãŒãã«ãããããã¥ã¡ã³ãã³ã³ãã³ãã®MIMEã¿ã€ãããªã¹ãããŸãã
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/> <Default Extension="xml" ContentType="application/xml"/> <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/> </Types>
_rels / .rels
ããã¥ã¡ã³ããªã³ã¯ã®ã¡ã€ã³ãªã¹ãã ãã®å Žåãå®çŸ©ãããé¢ä¿ã¯1ã€ã ãã§ãïŒèå¥årId1ãšword / document.xmlãã¡ã€ã«ãšã®æ¯èŒïŒ-ããã¥ã¡ã³ãã®æ¬æã
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/> </Relationships>
word / document.xml
ããã¥ã¡ã³ãã®ã¡ã€ã³ã³ã³ãã³ã ã
word / document.xml <w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14"> <w:body> <w:pw:rsidR="005F670F" w:rsidRDefault="005F79F5"> <w:r> <w:t>Test</w:t> </w:r> <w:bookmarkStart w:id="0" w:name="_GoBack"/> <w:bookmarkEnd w:id="0"/> </w:p> <w:sectPr w:rsidR="005F670F"> <w:pgSz w:w="12240" w:h="15840"/> <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/> <w:cols w:space="720"/> <w:docGrid w:linePitch="360"/> </w:sectPr> </w:body> </w:document>
ããã«ïŒ
<w:document>
-ããã¥ã¡ã³ãèªäœ<w:body>
-ããã¥ã¡ã³ãã®æ¬æ<w:p>
-段èœ<w:r>
-ããã¹ãã®å®è¡ïŒãã©ã°ã¡ã³ãïŒ<w:t>
-ããã¹ãèªäœ<w:sectPr>
-ããŒãžã®èª¬æ
ãã®ããã¥ã¡ã³ããããã¹ããšãã£ã¿ã§éããšã1ã€ã®åèªTest
ããããã¥ã¡ã³ãã衚瀺ãããŸãã
word / _rels / document.xml.rels
以äžã¯word/document.xml
ãžã®ãªã³ã¯ã®ãªã¹ãã§ãã ãªã³ã¯ãã¡ã€ã«ã®ååã¯ãé¢é£ããããã¥ã¡ã³ãã®äžéšã®ååãšã rels
æ¡åŒµã®è¿œå ããäœæãããŸãã ãªã³ã¯ãã¡ã€ã«ã®ãããã©ã«ããŒã¯_rels
ãšåŒã°ããé¢é£ããéšåãšåãã¬ãã«ã«ãããŸãã word/document.xml
ãªã³ã¯ããªãããword/document.xml
ãã¡ã€ã«ã¯ç©ºã§ãã
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> </Relationships>
ãªã³ã¯ããªãå Žåã§ãããã®ãã¡ã€ã«ãååšããŠããå¿
èŠããããŸãã
docxããã³Microsoft Word
docxã¯Microsoft Wordã䜿çšããŠäœæãããŸããããååãšããŠãä»ã®ãšãã£ã¿ãŒã®å©ããåããŠã ããã€ãã®è¿œå ãã¡ã€ã«ããããŸã ã

å«ãŸãããã®ã¯æ¬¡ã®ãšããã§ãã
docProps/core.xml
- Open Packaging Conventionsããã³Dublin Core [1] ã [2]ã«åºã¥ãäž»èŠãªããã¥ã¡ã³ãã¡ã¿ããŒã¿ãdocProps/app.xml
ããã¥ã¡ã³ãã«é¢ããäžè¬æ
å ± ïŒããŒãžæ°ãåèªãæåãããã¥ã¡ã³ããäœæãããã¢ããªã±ãŒã·ã§ã³ã®ååãªã©ãword/settings.xml
çŸåšã®ããã¥ã¡ã³ãã«é¢é£ããèšå® ãword/styles.xml
ããã¥ã¡ã³ãã«é©çšå¯èœãªã¹ã¿ã€ã« ã ãã¬ãŒã³ããŒã·ã§ã³ããããŒã¿ãåé¢ããŸããword/webSettings.xml
ããã¥ã¡ã³ãã®HTMLéšåã衚瀺ããããã®èšå®ãšãããã¥ã¡ã³ããHTMLã«å€æããæ¹æ³ã®èšå®ãword/fontTable.xml
ããã¥ã¡ã³ãã§äœ¿çšããããã©ã³ãã®ãªã¹ã ãword/theme1.xml
ããŒã ïŒé
è²ããã©ã³ããããã³æžåŒèšå®ã§æ§æãããŸãïŒã
è€éãªããã¥ã¡ã³ãã§ã¯ãããŒããããã«å€§ãããªãå¯èœæ§ããããŸãã
ãªããŒã¹ãšã³ãžãã¢ãªã³ã°docx
ãã®ãããæåã®ã¿ã¹ã¯ã¯ãããã¥ã¡ã³ãã®ãã©ã°ã¡ã³ããxmlã«ã©ã®ããã«ä¿åãããŠãããã調ã¹ããã®ãããªããã¥ã¡ã³ããèªåã§äœæïŒãŸãã¯è§£æïŒããããšã§ãã ããã«ã¯æ¬¡ã®ãã®ãå¿
èŠã§ãã
- Zipã¢ãŒã«ã€ããŒ
- XMLãã©ãŒãããã©ã€ãã©ãªïŒWordã¯1è¡ã§ã€ã³ãã³ããããXMLãçæããŸãïŒ
- ãã¡ã€ã«éã®å·®åã衚瀺ããããã®ããŒã«ãgitãšTortoiseGitã䜿çšããŸã
ããŒã«
ãŸããXMLãèªåçã«ïŒäžåºŠïŒã¢ãŒã«ã€ãããã³ãã©ãŒãããããããã®ã¹ã¯ãªãããå¿
èŠã«ãªããŸãã
Windowsã§äœ¿çšïŒ
unpack file dir
dir- file
ããã¥ã¡ã³ããdir
ãã©ã«ãã«ã¢ã³ããã¯ããxmlããã©ãŒãããããŸãpack dir file
- pack dir file
ãã©ã«ããŒãfile
ããã¥ã¡ã³ãã«pack dir file
ãŸã
Linuxã§ã®äœ¿çšãåæ§ã§ã unpack
ã§ã¯ãªã./unpack.sh
ã®ã¿ã§ã pack
ã¯./pack.sh
ãªã./pack.sh
ã
䜿çšãã
倿Žã®æ€çŽ¢ã¯æ¬¡ã®ãšããã§ãã
- ãšãã£ã¿ãŒã§ç©ºã®docxãã¡ã€ã«ãäœæããŸãã
unpack
ããŠæ°ãããã©ã«ããŒã«unpack
ããŸãã- æ°ãããã©ã«ããŒãã³ãããããŸãã
- 調æ»äžã®èŠçŽ ïŒãã€ããŒãªã³ã¯ãããŒãã«ãªã©ïŒãpã1ãããã¡ã€ã«ã«è¿œå ããŸãã
- 倿Žãããã¡ã€ã«ãæ¢åã®ãã©ã«ããŒã«è§£åããŸãã
- diffãç ç©¶ããäžå¿
èŠãªå€æŽïŒé¢ä¿ã®çœ®æãåå空éã®é åºãªã©ïŒãåé€ããŸãã
- ãã©ã«ããŒãããã¯ããçµæã®ãã¡ã€ã«ãéãããšã確èªããŸãã
- 倿Žããããã©ã«ããŒãã³ãããããŸãã
äŸ1.ããã¹ãã匷調衚瀺ãã
å®éã«ã倪åã®ããã¹ãã®ãã©ãŒããããå®çŸ©ããã¿ã°ãèŠã€ããæ¹æ³ãèŠãŠã¿ãŸãããã
- 倪åã§ã¯ãªããã¹ãããã¹ãã䜿çšããŠ
bold.docx
ããã¥ã¡ã³ããäœæããŸãã unpack bold.docx bold
ïŒ unpack bold.docx bold
ã- çµæãã³ãããããŸãã
- Testãšããããã¹ãã倪åã§åŒ·èª¿è¡šç€ºããŸãã
unpack bold.docx bold
ãunpack bold.docx bold
ã- æåãdiffã¯æ¬¡ã®ããã«ãªããŸããã

è©³çŽ°ã«æ€èšããŠãã ããã
docProps / app.xml
@@ -1,9 +1,9 @@ - <TotalTime>0</TotalTime> + <TotalTime>1</TotalTime>
æéã®å€æŽã¯å¿
èŠãããŸããã
docProps / core.xml
@@ -4,9 +4,9 @@ - <cp:revision>1</cp:revision> + <cp:revision>2</cp:revision> <dcterms:created xsi:type="dcterms:W3CDTF">2017-02-07T19:37:00Z</dcterms:created> - <dcterms:modified xsi:type="dcterms:W3CDTF">2017-02-07T19:37:00Z</dcterms:modified> + <dcterms:modified xsi:type="dcterms:W3CDTF">2017-02-08T10:01:00Z</dcterms:modified>
ããã¥ã¡ã³ãã®ããŒãžã§ã³ãšå€æŽæ¥ã倿ŽããŠããèå³ã¯ãããŸããã
word / document.xml
diff @@ -1,24 +1,26 @@ <w:body> - <w:pw:rsidR="0076695C" w:rsidRPr="00290C70" w:rsidRDefault="00290C70"> + <w:pw:rsidR="0076695C" w:rsidRPr="00F752CF" w:rsidRDefault="00290C70"> <w:pPr> <w:rPr> + <w:b/> <w:lang w:val="en-US"/> </w:rPr> </w:pPr> - <w:r> + <w:rw:rsidRPr="00F752CF"> <w:rPr> + <w:b/> <w:lang w:val="en-US"/> </w:rPr> <w:t>Test</w:t> </w:r> <w:bookmarkStart w:id="0" w:name="_GoBack"/> <w:bookmarkEnd w:id="0"/> </w:p> - <w:sectPr w:rsidR="0076695C" w:rsidRPr="00290C70"> + <w:sectPr w:rsidR="0076695C" w:rsidRPr="00F752CF">
w:rsidR
ã®å€æŽã¯è峿·±ãw:rsidR
ãŸãã-ããã¯Microsoft Wordã®å
éšæ
å ±ã§ãã ããã§éèŠãªå€æŽ
<w:rPr> + <w:b/>
ãã¹ãä»ãã®æ®µèœã ã©ããã<w:b/>
èŠçŽ ãããã¹ãã倪åã«ããŸãã ãã®å€æŽãæ®ããæ®ãããã£ã³ã»ã«ããŸãã
word / settings.xml
@@ -1,8 +1,9 @@ + <w:proofState w:spelling="clean"/> @@ -17,10 +18,11 @@ + <w:rsid w:val="00F752CF"/>
ãŸãã倪åã®ããã¹ãã«é¢é£ãããã®ãå«ãŸããŠããŸããã ãã£ã³ã»ã«ã
7æåã®å€æŽïŒ <w:b/>
远å ïŒã§ãã©ã«ããŒãããã¯ãã ããã¥ã¡ã³ããéããŠäºæããå
容ã衚瀺ããããšã確èªããŸãã
8 倿Žãã³ãããããŸã ã
äŸ2.ããã¿ãŒ
次ã«ãããè€éãªäŸãèŠãŠã¿ãŸããã-ããã¿ãŒã远å ããŸãã
ãããæåã®ã³ãããã§ãã ããã¹ã123ã®ããã¿ãŒã远å ããããã¥ã¡ã³ããè§£åããŸãã ãã®ãããªå·®åã¯æåã«ååŸãããŸãïŒ

docProps/app.xml
ããã³docProps/core.xml
ãžã®å€æŽãããã«é€å€ããŸã-æåã®äŸãšåããã®ã§ãã
[Content_Types] .xml
@@ -4,10 +4,13 @@ <Default Extension="xml" ContentType="application/xml"/> <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/> + <Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/> + <Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/> + <Override PartName="/word/footer1.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"/>
ããã¿ãŒã¯æããã«å¿
èŠãªãã®ã®ããã«èŠããŸãããèæ³šãšææ«èæ³šã¯ã©ãããã°ããã§ããããïŒ ããã¿ãŒã远å ããéã«å¿
é ã§ããããããšãåæã«äœæãããŸããïŒ ãã®è³ªåã«å¯Ÿããçãã¯å¿
ãããç°¡åã§ã¯ãããŸãããäž»ãªæ¹æ³ã次ã«ç€ºããŸãã
- 倿Žãäºãã«é¢é£ããŠãããã©ããã確èªãã
- å®éšãã
- ãŸããäœãèµ·ãã£ãŠããã®ãã¯ã£ããããªãå ŽåïŒ

ãããŸã§ã¯ããã«é²ãã§ãããŸãã
word / _rels / document.xml.rels
æåãdiffã¯æ¬¡ã®ããã«ãªããŸãã
diff @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> + <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml"/> + <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/> - <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/> - <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/> + <Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/> + <Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/> + <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/> </Relationships>
倿Žã®äžéšã¯ãWordããªã³ã¯ã®é åºã倿Žãããšããäºå®ã«ãããã®ã§ãããããããåé€ããããšãããããŸãã
@@ -3,6 +3,9 @@ + <Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/> + <Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/> + <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/>
ããã¿ãŒãèæ³šãææ«èæ³šãåã³è¡šç€ºãããŸãã ãããã¯ãã¹ãŠã¡ã€ã³ããã¥ã¡ã³ãã«é¢é£ä»ããããŠããŸããæ¬¡ã«é²ã¿ãŸãããã
word / document.xml
@@ -15,10 +15,11 @@ </w:r> <w:bookmarkStart w:id="0" w:name="_GoBack"/> <w:bookmarkEnd w:id="0"/> </w:p> <w:sectPr w:rsidR="0076695C" w:rsidRPr="00290C70"> + <w:footerReference w:type="default" r:id="rId6"/> <w:pgSz w:w="11906" w:h="16838"/> <w:pgMar w:top="1134" w:right="850" w:bottom="1134" w:left="1701" w:header="708" w:footer="708" w:gutter="0"/> <w:cols w:space="708"/> <w:docGrid w:linePitch="360"/> </w:sectPr>
å¿
èŠãªå€æŽã®ã¿ããããŸããªã±ãŒã¹ã sectPrããããã¿ãŒãžã®æç€ºçãªãªã³ã¯ã衚瀺ãããŸã ã ãŸããããã¥ã¡ã³ãã«ã¯èæ³šãææ«è泚ãžã®ãªã³ã¯ããªãããããããã¯å¿
èŠãªããšæ³å®ã§ããŸãã
word / settings.xml
diff @@ -1,19 +1,30 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <w:settings xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" mc:Ignorable="w14 w15"> <w:zoom w:percent="100"/> + <w:proofState w:spelling="clean"/> <w:defaultTabStop w:val="708"/> <w:characterSpacingControl w:val="doNotCompress"/> + <w:footnotePr> + <w:footnote w:id="-1"/> + <w:footnote w:id="0"/> + </w:footnotePr> + <w:endnotePr> + <w:endnote w:id="-1"/> + <w:endnote w:id="0"/> + </w:endnotePr> <w:compat> <w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/> <w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/> <w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/> <w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/> <w:compatSetting w:name="differentiateMultirowTableHeaders" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/> </w:compat> <w:rsids> <w:rsidRoot w:val="00290C70"/> + <w:rsid w:val="000A7B7B"/> + <w:rsid w:val="001B0DE6"/>
ãããŠãããã«è泚ãžã®ãªã³ã¯ãææžã«ãããã远å ããå·»æ«æ³šããããŸãã
word / styles.xml
diff @@ -480,6 +480,50 @@ <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/> <w:b/> <w:sz w:val="28"/> </w:rPr> </w:style> + <w:style w:type="paragraph" w:styleId="a4"> + <w:name w:val="header"/> + <w:basedOn w:val="a"/> + <w:link w:val="a5"/> + <w:uiPriority w:val="99"/> + <w:unhideWhenUsed/> + <w:rsid w:val="000A7B7B"/> + <w:pPr> + <w:tabs> + <w:tab w:val="center" w:pos="4677"/> + <w:tab w:val="right" w:pos="9355"/> + </w:tabs> + <w:spacing w:after="0" w:line="240" w:lineRule="auto"/> + </w:pPr> + </w:style> + <w:style w:type="character" w:customStyle="1" w:styleId="a5"> + <w:name w:val=" "/> + <w:basedOn w:val="a0"/> + <w:link w:val="a4"/> + <w:uiPriority w:val="99"/> + <w:rsid w:val="000A7B7B"/> + </w:style> + <w:style w:type="paragraph" w:styleId="a6"> + <w:name w:val="footer"/> + <w:basedOn w:val="a"/> + <w:link w:val="a7"/> + <w:uiPriority w:val="99"/> + <w:unhideWhenUsed/> + <w:rsid w:val="000A7B7B"/> + <w:pPr> + <w:tabs> + <w:tab w:val="center" w:pos="4677"/> + <w:tab w:val="right" w:pos="9355"/> + </w:tabs> + <w:spacing w:after="0" w:line="240" w:lineRule="auto"/> + </w:pPr> + </w:style> + <w:style w:type="character" w:customStyle="1" w:styleId="a7"> + <w:name w:val=" "/> + <w:basedOn w:val="a0"/> + <w:link w:val="a6"/> + <w:uiPriority w:val="99"/> + <w:rsid w:val="000A7B7B"/> + </w:style> </w:styles>
ã¹ã¿ã€ã«ã®å€æŽã¯ãã¹ã¿ã€ã«ã®å€æŽæ¹æ³ãæ¢ããŠããå Žåã«ã®ã¿èå³ããããŸãã ãã®å Žåããã®å€æŽã¯åé€ã§ããŸãã
次ã«ãããã¿ãŒèªäœãèŠãŠã¿ãŸãããïŒåå空éã®äžéšã¯èªã¿ãããããããã«çç¥ãããŠããŸãããããã¥ã¡ã³ãå
ã«ããå¿
èŠããããŸãïŒã
<w:ftr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <w:pw:rsidR="000A7B7B" w:rsidRDefault="000A7B7B"> <w:pPr> <w:pStyle w:val="a6"/> </w:pPr> <w:r> <w:t>123</w:t> </w:r> </w:p> </w:ftr>
ããã§ã¯ãããã¹ã123ã衚瀺ãããŠããŸãããä¿®æ£ããå¿
èŠãããã®ã¯ã <w:pStyle w:val="a6"/>
ãžã®ãªã³ã¯ãåé€ããããšã ãã§ãã
ãã¹ãŠã®å€æŽãåæããçµæãæ¬¡ã®ããšãæ³å®ããŠããŸãã
- èæ³šãšææ«èæ³šã¯äžèŠã§ã
[Content_Types].xml
ã«ããã¿ãŒã远å ã[Content_Types].xml
word/_rels/document.xml.rels
ã§ã¯ãããã¿ãŒã«ãªã³ã¯ã远å ããå¿
èŠããããŸãword/document.xml
ã <w:footerReference>
ã<w:footerReference>
diffãæ¬¡ã®å€æŽã»ããã«æžãããŸãïŒ

次ã«ã ããã¥ã¡ã³ããããã¯ããŠéããŸãã
ãã¹ãŠãæ£ããè¡ããããšãããã¥ã¡ã³ããéããããã¹ã123ã®ããã¿ãŒã衚瀺ãããŸãããããŠãæåŸã®ã³ãããã§ãã
ãããã£ãŠã倿ŽãèŠã€ããããã»ã¹ã¯ãæå®ã®çµæãéæããã®ã«ååãªæå°ã®å€æŽã»ãããèŠã€ããããšã«åæžãããŸãã
ç·Žç¿ãã
é¢å¿ã®ãã倿ŽãèŠã€ããã®ã§ãæ¬¡ã®æ®µéã«é²ãã®ãè«ççã§ãã
- docxãäœæãã
- docxã®è§£æ
- Docx倿
ããã§ã¯ã XSLTãšXPathã®ç¥èãå¿
èŠã§ãã
æ¢åã®ããã¥ã¡ã³ãã®ããã¿ãŒã眮æãŸãã¯è¿œå ãããããªãåçŽãªå€æãäœæããŸãããã CachéObjectScriptèšèªã§èšè¿°ããŸããããããç¥ããªããŠãåé¡ã§ã¯ãããŸããã äž»ã«XSLTãšã¢ãŒã«ã€ããåŒã³åºããŸãã ãã以äžã ããã§ã¯å§ããŸãããã
ã¢ã«ãŽãªãºã
ã¢ã«ãŽãªãºã ã¯æ¬¡ã®ãšããã§ãã
- ããã¥ã¡ã³ãã鿢±ããŸãã
- ããã¿ãŒã远å ããŸãã
- ãªã³ã¯ã
[Content_Types].xml
ããã³word/_rels/document.xml.rels
æžã蟌ã¿word/_rels/document.xml.rels
ã <w:sectPr>
ã¿ã°ã®word/document.xml
ã§ã <w:sectPr>
ã¿ã°ã远å ãããããã®äžã®ããã¿ãŒãžã®ãªã³ã¯ã眮ãæããŸãã- ããã¥ã¡ã³ããããã¯ããŸãã
å§ããŸãããã
鿢±
CachéObjectScriptã«ã¯ã $ zfïŒ-1ãoscommandïŒé¢æ°ã䜿çšããŠOSã³ãã³ããå®è¡ããæ©èœããããŸã ã unzipãåŒã³åºããŠã $ zfïŒ-1ïŒäžã®ã©ãããŒã䜿çšããŠããã¥ã¡ã³ããè§£åããŸãã
/// %3 (unzip) %1 %2 Parameter UNZIP = "%3 %1 -d %2"; /// source targetDir ClassMethod executeUnzip(source, targetDir) As %Status { set timeout = 100 set cmd = $$$FormatText(..
ããã¿ãŒãã¡ã€ã«ãäœæãã
å
¥åã¯ããã¿ãŒã®ããã¹ãã§ãããin.xmlãã¡ã€ã«ã«æžã蟌ã¿ãŸãã
<xml>TEST</xml>
XSLTïŒãã¡ã€ã«ã¯footer.xslïŒã§ãxmlã¿ã°ã®ããã¹ãã䜿çšããŠããã¿ãŒãäœæããŸãïŒåå空éã®äžéšã¯çç¥ãããŠããŸããããã«å®å
šãªãªã¹ãããããŸã ïŒã
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.openxmlformats.org/package/2006/relationships" version="1.0"> <xsl:output method="xml" omit-xml-declaration="no" indent="yes" standalone="yes"/> <xsl:template match="/"> <w:ftr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <w:p> <w:r> <w:rPr> <w:lang w:val="en-US"/> </w:rPr> <w:t> <xsl:value-of select="//xml/text()"/> </w:t> </w:r> </w:p> </w:ftr> </xsl:template> </xsl:stylesheet>
次ã«ã XSLTã³ã³ããŒã¿ãŒãåŒã³åºããŸã ã
do ##class(%XML.XSLT.Transformer).TransformFile("in.xml", "footer.xsl", footer0.xml")
çµæã¯footer0.xml
ããã¿ãŒfooter0.xml
ïŒ
<w:ftr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <w:p> <w:r> <w:rPr> <w:lang w:val="en-US"/> </w:rPr> <w:t>TEST</w:t> </w:r> </w:p> </w:ftr>
ã¡ã€ã³ããã¥ã¡ã³ãã®ãªã³ã¯ãªã¹ãã«ããã¿ãŒãªã³ã¯ã远å ãã
ã«ãŒã«ãšããŠèå¥årId0
ãæã€ãªã³ã¯ã¯ååšããŸããã ãã ããXPathã䜿çšããŠãååšããªãèå¥åãååŸã§ããŸãã
word/_rels/document.xml.rels
_rels word/_rels/document.xml.rels
èå¥årId0ãæã€footer0.xml
ãžã®ãªã³ã¯ã远å ãword/_rels/document.xml.rels
ã
XSLT <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.openxmlformats.org/package/2006/relationships" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="no" /> <xsl:param name="new"> <Relationship Id="rId0" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer0.xml"/> </xsl:param> <xsl:template match="/*"> <xsl:copy> <xsl:copy-of select="$new"/> <xsl:copy-of select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
ããã¥ã¡ã³ãå
ã®ãªã³ã¯ãèŠå®ããŸã
次ã«ãå<w:sectPr>
ã¿ã°ã«<w:sectPr>
ã¿ã°ã远å ãããããã®äžã®ããã¿ãŒãžã®ãªã³ã¯ã眮ãæããå¿
èŠããããŸãã å<w:sectPr>
ã¯ã3ã€ã®<w:footerReference>
ããšãã§ããããšã倿ããŸãããæåã®ããŒãžãããŒãžãããã³ãã®ä»ãã¹ãŠã«å¯ŸããŠïŒ
XSLT <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:template match="//@* | //node()"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> <xsl:template match="//w:sectPr"> <xsl:element name="{name()}" namespace="{namespace-uri()}"> <xsl:copy-of select="./namespace::*"/> <xsl:apply-templates select="@*"/> <xsl:copy-of select="./*[local-name() != 'footerReference']"/> <w:footerReference w:type="default" r:id="rId0"/> <w:footerReference w:type="first" r:id="rId0"/> <w:footerReference w:type="even" r:id="rId0"/> </xsl:element> </xsl:template> </xsl:stylesheet>
[Content_Types].xml
ããã¿ãŒã远å ã[Content_Types].xml
/word/footer0.xml
ãapplication/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
åã§ãããšããæ
å ±ã[Content_Types].xml
远å ããŸãã
XSLT <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.openxmlformats.org/package/2006/content-types" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="no" /> <xsl:param name="new"> <Override PartName="/word/footer0.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"/> </xsl:param> <xsl:template match="/*"> <xsl:copy> <xsl:copy-of select="@* | node()"/> <xsl:copy-of select="$new"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
çµæãšããŠ
ãã¹ãŠã®ã³ãŒããå
¬éãããŠããŸãã æ¬¡ã®ããã«æ©èœããŸãã
do ##class(Converter.Footer).modifyFooter("in.docx", "out.docx", "TEST")
ã©ãã§ïŒ
in.docx
ãœãŒã¹ããã¥ã¡ã³ãout.docx
éä¿¡ããã¥ã¡ã³ãTEST
ããã¿ãŒã«è¿œå ãããããã¹ã
çµè«
XSLTãšZIPã®ã¿ã䜿çšãããšãdocxããã¥ã¡ã³ããxlsxããŒãã«ãpptxãã¬ãŒã³ããŒã·ã§ã³ãæ£åžžã«åŠçã§ããŸãã
æªè§£æ±ºã®è³ªå
- æåã¯ãzip / unzip tã®ä»£ããã«7zã䜿çšãããã£ãã®ã§ããããã¯1ã€ã®ãŠãŒãã£ãªãã£ã§ãããWindowsã§ããäžè¬çã§ããããã§ãã ããããLinuxã§7zã«ããã¯ãããããã¥ã¡ã³ããMicrosoft Officeã§éããªããšããåé¡ã«ééããŸããã å€ãã®é話ãªãã·ã§ã³ã詊ããŸããããè¯ãçµæãåŸãããšãã§ããŸããã§ããã
- ECMA-376ããŒãžã§ã³5ã®åè·¯ãšã³ã¡ã³ããå«ãXSDãæ¢ããŠããŸãã ã³ã¡ã³ããªãã®XSDããŒãžã§ã³5ã¯ãECMA Webãµã€ãããããŠã³ããŒãã§ããŸãããã³ã¡ã³ããªãã§ã¯çè§£ãå°é£ã§ãã ã³ã¡ã³ãä»ãã®XSDããŒãžã§ã³2ãããŠã³ããŒãã§ããŸãã
åç
§è³æ