DOCX Dateien erstellen ohne Microsoft Office installiert zu haben

  • VB.NET

Es gibt 6 Antworten in diesem Thema. Der letzte Beitrag () ist von Dodo.

    DOCX Dateien erstellen ohne Microsoft Office installiert zu haben

    Sehr geehrte Forenuser,

    da meine ODTdll Datei wahrscheinlich lange brauchen wird, möchte ich mal wissen, ob es eine Möglichkeit gibt, DOCX Dateien mi VB.NET zu erstellen, ohne Microsoft Office installiert zu haben.

    Also Ziel ist es, dass das fertige Programm DOCX auf PCs auch ohne installiertem Microsoft Office erstellen kann. Ist dies möglich ohne externe DLLs zu nutzen?

    Mit freundlichen Grüßen,
    Sepultura
    nö - ist nicht möglich. Klar kannst du irgendeine Datei mit der Extension .docx abspeichern, aber dass die auch zuverlässig als .docx funktioniert ist mehr als unwahrscheinlich.
    V.a., wenn du auf externe Libs verzichten willst, wirst du das in solchen Libs steckende KnowHow dir ja selbst aus den Fingern saugen müssen.
    ich würde ja Libs unter LGPL und MIT Lizenz nutzen, aber mein Chef will das nicht, weil er Angst hat, verklagt zu werden.

    Auch wenn LGPL und MIT Lizenz ja sagt, dass Closed Source software diese Libs nutzen darf.

    Die Entwickler könnten ja schnell die Lizenz ändern :whistling:
    Mit docx währe es vermutlich doch möglich, wenn auch sehr aufwändig, aber aufjedenfall einfacherer als ein .doc zu erzeugen, da docx ja nun mittlerweile auch nur noch ein Container Format ist, heißt du kannst docx ind zip umbenennen und reinschauen, darin findest du jede Menge XML Dateien die das Dokument beschreiben, Inhalt, Formatierungen usw. du musst also nur diese Struktur des docx Dokumentes selbst bauen, schauen welche XML verändern musst, dass sich der Inhalt in Word ändern und dann packst das alles in eine ZIP und nennst die in docx um, das dürfte durchaus machbar sein, wird aber sicher einiges an fummel Arbeit werden.
    Hi,
    ich hab mal mit php .doc dokumente erstellt, dürfte mit vb aber fast genauso gehen
    Spoiler anzeigen

    HTML-Quellcode

    1. <?php
    2. ob_start();
    3. header("Content-type: application/vnd.ms-word");
    4. header("Content-Disposition: attachment;Filename=wordtest.doc");
    5. ?>
    6. <html
    7. xmlns:o='urn:schemas-microsoft-com:office:office'
    8. xmlns:w='urn:schemas-microsoft-com:office:word'
    9. xmlns='http://www.w3.org/TR/REC-html40'>
    10. <head>
    11. <title>wordtest</title>
    12. <!--[if gte mso 9]>
    13. <xml>
    14. <w:WordDocument>
    15. <w:View>Print</w:View>
    16. <w:Zoom>100</w:Zoom>
    17. <w:DoNotOptimizeForBrowser/>
    18. </w:WordDocument>
    19. </xml>
    20. <![endif]-->
    21. <style>
    22. <!--
    23. /* Font Definitions */
    24. @font-face
    25. {font-family:Wingdings;
    26. panose-1:5 0 0 0 0 0 0 0 0 0;}
    27. @font-face
    28. {font-family:Wingdings;
    29. panose-1:5 0 0 0 0 0 0 0 0 0;}
    30. @font-face
    31. {font-family:Tahoma;
    32. panose-1:2 11 6 4 3 5 4 4 2 4;}
    33. /* Style Definitions */
    34. p.MsoNormal, li.MsoNormal, div.MsoNormal
    35. {margin:0cm;
    36. margin-bottom:.0001pt;
    37. font-size:12.0pt;
    38. font-family:"Times New Roman","serif";}
    39. h1
    40. {margin:0cm;
    41. margin-bottom:.0001pt;
    42. page-break-after:avoid;
    43. font-size:14.0pt;
    44. font-family:"Arial","sans-serif";}
    45. h2
    46. {margin:0cm;
    47. margin-bottom:.0001pt;
    48. page-break-after:avoid;
    49. font-size:12.0pt;
    50. font-family:"Arial","sans-serif";}
    51. p.MsoListBullet, li.MsoListBullet, div.MsoListBullet
    52. {margin-top:0cm;
    53. margin-right:0cm;
    54. margin-bottom:0cm;
    55. margin-left:18.0pt;
    56. margin-bottom:.0001pt;
    57. text-indent:-18.0pt;
    58. font-size:12.0pt;
    59. font-family:"Times New Roman","serif";}
    60. p.MsoListBulletCxSpFirst, li.MsoListBulletCxSpFirst, div.MsoListBulletCxSpFirst
    61. {margin-top:0cm;
    62. margin-right:0cm;
    63. margin-bottom:0cm;
    64. margin-left:18.0pt;
    65. margin-bottom:.0001pt;
    66. text-indent:-18.0pt;
    67. font-size:12.0pt;
    68. font-family:"Times New Roman","serif";}
    69. p.MsoListBulletCxSpMiddle, li.MsoListBulletCxSpMiddle, div.MsoListBulletCxSpMiddle
    70. {margin-top:0cm;
    71. margin-right:0cm;
    72. margin-bottom:0cm;
    73. margin-left:18.0pt;
    74. margin-bottom:.0001pt;
    75. text-indent:-18.0pt;
    76. font-size:12.0pt;
    77. font-family:"Times New Roman","serif";}
    78. p.MsoListBulletCxSpLast, li.MsoListBulletCxSpLast, div.MsoListBulletCxSpLast
    79. {margin-top:0cm;
    80. margin-right:0cm;
    81. margin-bottom:0cm;
    82. margin-left:18.0pt;
    83. margin-bottom:.0001pt;
    84. text-indent:-18.0pt;
    85. font-size:12.0pt;
    86. font-family:"Times New Roman","serif";}
    87. p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
    88. {margin-top:0cm;
    89. margin-right:.2pt;
    90. margin-bottom:0cm;
    91. margin-left:0cm;
    92. margin-bottom:.0001pt;
    93. font-size:12.0pt;
    94. font-family:"Arial","sans-serif";}
    95. p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent
    96. {margin-top:0cm;
    97. margin-right:0cm;
    98. margin-bottom:0cm;
    99. margin-left:108.0pt;
    100. margin-bottom:.0001pt;
    101. text-indent:-108.0pt;
    102. font-size:12.0pt;
    103. font-family:"Arial","sans-serif";}
    104. p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
    105. {margin-top:0cm;
    106. margin-right:-17.8pt;
    107. margin-bottom:0cm;
    108. margin-left:0cm;
    109. margin-bottom:.0001pt;
    110. font-size:12.0pt;
    111. font-family:"Arial","sans-serif";}
    112. p.MsoBlockText, li.MsoBlockText, div.MsoBlockText
    113. {margin-top:0cm;
    114. margin-right:-35.8pt;
    115. margin-bottom:0cm;
    116. margin-left:177.0pt;
    117. margin-bottom:.0001pt;
    118. text-indent:-70.8pt;
    119. font-size:12.0pt;
    120. font-family:"Arial","sans-serif";}
    121. p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
    122. {mso-style-link:"Sprechblasentext Zchn";
    123. margin:0cm;
    124. margin-bottom:.0001pt;
    125. font-size:8.0pt;
    126. font-family:"Tahoma","sans-serif";}
    127. span.SprechblasentextZchn
    128. {mso-style-name:"Sprechblasentext Zchn";
    129. mso-style-link:Sprechblasentext;
    130. font-family:"Tahoma","sans-serif";}
    131. @page WordSection1
    132. {size:595.3pt 841.9pt;
    133. margin:1.0cm 70.9pt 19.85pt 65.2pt;}
    134. div.WordSection1
    135. {page:WordSection1;}
    136. /* List Definitions */
    137. ol
    138. {margin-bottom:0cm;}
    139. ul
    140. {margin-bottom:0cm;}
    141. -->
    142. </style>
    143. </head>
    144. <body lang=DE style='tab-interval:1.27cm'>
    145. <div class=WordSection1>
    146. <h1>Das ist</h1>
    147. <h1>nur</h1>
    148. <h1>Ein Test</h1>
    149. <p class=MsoNormal>
    150. <b>
    151. <span style='font-size:14.0pt;font-family:"Arial","sans-serif"'>
    152. blablabla
    153. </span>
    154. </b>
    155. </p>
    156. <p class=MsoNormal>
    157. <b>
    158. <span style='font-size:14.0pt;font-family:"Arial","sans-serif"'>
    159. bliblablu
    160. </span>
    161. </b>
    162. </p>
    163. <p class=MsoNormal>
    164. <b>
    165. <span style='font-family:"Arial","sans-serif"'>
    166. und immer so weiter
    167. </span>
    168. </b>
    169. </p>
    170. </div>
    171. </body>
    172. </html>
    173. <?php
    174. ob_flush();
    175. ?>

    Das ist eigentlich eine als Doc verkleidete HTML-Seite die mit "<w:View>Print</w:View>" auch als Doc angezeigt wird, aber es tat für mich was ich brauchte.
    Das Basis-Template kann man bekommen wenn man in Word eine Datei unter "Vereinfachtes HTML" (oder so) speichert.
    Dieselbe Methode bei Docx anzuwenden wird dann nicht mehr so schwierig sein.

    Viel Erfolg noch,
    SᴛᴀʀGᴀᴛᴇ01