__SoSci to Word__ : Projekt erfolgreich abgeschlossen
This commit is contained in:
parent
df7b16c177
commit
01fc817098
2 changed files with 60 additions and 61 deletions
|
|
@ -28,7 +28,26 @@ vorgesehen ist; eine 80%-Lösung ist bereits mehr als genug.
|
|||
Format des SoSci-XML
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
[red]#TODO#
|
||||
Es handelt sich um ein XML-Dokument mit DTD-Document-Type.
|
||||
Die Struktur gliedert sich in eine Sammlung von `<section>`-Elementen, in denen
|
||||
die einzelnen Items als `<question>` aufgelistet sind. An diese Sequenz mit Inhalten
|
||||
schließt sich ein Element `<surveyLayout>` an, in das ein HTML-Template direkt
|
||||
eingebettet ist.
|
||||
|
||||
Als letzter Abschnitt folgt ein Element `<questionnaire>`, in dem aus den
|
||||
gesammelten Inhalten der konkrete Online-Fragebogen zusammengestellt wird.
|
||||
Dieser Abschnitt enthält eine Menge von Attributen im key/value-Format.
|
||||
Im Besonderen das Attribut `"content"` enthält ein verschachteltes XML-Dokument,
|
||||
eingebettet als XML-quoted text. Dieses verschachtelte Dokument listet eine
|
||||
Folge von `<page>`-Elementen auf, welche wiederum jeweils eine Liste von
|
||||
`<question>`-Elementen enthalten; diese referenzieren per ID auf die Definitionen
|
||||
und Inhalte für die einzelnen Items. Zusätzlich können weitere Seiteninhalte
|
||||
direkt als HTML-Elemente hinzugefügt werden, welche dann als CDATA eingebettet sind.
|
||||
|
||||
Für die Generierung der Darstellung im Word-Format bietet es sich daher an,
|
||||
dieser Auflistung zu folgen, und die per ID referenzierten Elemente aus einem
|
||||
Dictionary zu entnehmen.
|
||||
|
||||
|
||||
Format der Word-Datei
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -48,7 +67,6 @@ Sowohl Block-, alsauch Inline-Elemente sind direkt mit einem _Style_ ausgezeichn
|
|||
Dieser kann sowohl _direkte Formatierung_ umfassen, aber auch auf einen _definierten Style_
|
||||
aus dem Stylesheet (``Formatvorlage'') per Name-ID verweisen.
|
||||
|
||||
[yellow-background]#WIP#
|
||||
|
||||
|
||||
Implementierung
|
||||
|
|
@ -104,7 +122,21 @@ Die Verarbeitung untergliedert sich in drei Phasen:
|
|||
* Word-Dokument unter neuem Namen speichern
|
||||
|
||||
|
||||
[yellow-background]#WIP#
|
||||
|
||||
Anwendung
|
||||
~~~~~~~~~
|
||||
|
||||
Das eigentliche Python-Skript habe ich dann in einer einzigen ``Demo-Coding-Sitzung''
|
||||
zusammen mit Daniela Zutavern entwickelt und getestet. Am Ende dieser Sitzung konnte
|
||||
ein Word-Dokument generiert werden, welches dann in das bereits bestehende Dokument
|
||||
für ihre Bachelor-Arbeit importiert wurde. Seitenumbrüche und Überschriften wurden
|
||||
sodann manuell formatiert und angeglichen.
|
||||
|
||||
Zusammenfassend kann dieses kleine Projekt als Erfolg gewertet werden; es wurde viel
|
||||
Zeit bei der Aufbereitung der Arbeit gespart, und die eingebundenen Inhalte sind
|
||||
dargestellt in perfekter Qualität, ohne das Dokument nennenswert durch Grafik-Inhalte
|
||||
zu belasten.
|
||||
|
||||
Die Erstellung der Bachelor-Arbeit war Anfang August 2023 abgeschlossen.
|
||||
Diese Abschlußarbeit wurde mit Note 1.7 bewertet.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
|
||||
<node BACKGROUND_COLOR="#cad8eb" COLOR="#24566c" CREATED="1684368057062" ID="ID_1631189012" MODIFIED="1684368222301">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p style="text-align: center">
|
||||
SoSci
|
||||
|
|
@ -20,9 +18,7 @@
|
|||
<font NAME="SansSerif" SIZE="25"/>
|
||||
<node COLOR="#338800" CREATED="1684368358553" FOLDED="true" ID="ID_1393333722" MODIFIED="1684370541179" POSITION="right">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
<u>Installation</u>
|
||||
|
|
@ -43,9 +39,7 @@
|
|||
</node>
|
||||
<node CREATED="1684369745677" ID="ID_407462667" MODIFIED="1684369755771">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
<font face="Monospaced">pip3 install python-docx</font>
|
||||
|
|
@ -120,9 +114,7 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1684438106326" ID="ID_1797565143" MODIFIED="1684438169141" TEXT="die Style-Namen via python-docx sind doch so wie in Word angezeigt">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...und nicht die reine Name-ID, die man im document.xml bzw. styles.xml sieht. Da passiert anscheinend eine Übersetzung
|
||||
|
|
@ -132,9 +124,7 @@
|
|||
</node>
|
||||
<node CREATED="1684438169989" ID="ID_1369606274" MODIFIED="1684438196649" TEXT="man sollte sich die verfügbaren Styles auflisten lassen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
styles = document.styles
|
||||
|
|
@ -225,8 +215,8 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1684368507446" ID="ID_1735162824" MODIFIED="1684521700693" POSITION="right" TEXT="Python-Skript">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
<node COLOR="#338800" CREATED="1684368507446" ID="ID_1735162824" MODIFIED="1684532266655" POSITION="right" TEXT="Python-Skript">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1684368529445" ID="ID_676425093" MODIFIED="1684534447099" TEXT="Implementierung">
|
||||
<arrowlink DESTINATION="ID_1966384514" ENDARROW="Default" ENDINCLINATION="-105;-9;" ID="Arrow_ID_1306849550" STARTARROW="None" STARTINCLINATION="-105;-9;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -315,8 +305,10 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1684368546729" ID="ID_1056322615" MODIFIED="1684368551424" POSITION="right" TEXT="Anwendung">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
<node BACKGROUND_COLOR="#c8c0b6" COLOR="#338800" CREATED="1684368546729" HGAP="9" ID="ID_1056322615" MODIFIED="1684532266655" POSITION="right" STYLE="bubble" TEXT="Anwendung erfolgreich" VSHIFT="25">
|
||||
<edge COLOR="#0a7f71"/>
|
||||
<font NAME="SansSerif" SIZE="15"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1684368369272" FOLDED="true" ID="ID_1920026774" MODIFIED="1684450294772" POSITION="left" TEXT="XML verstehen">
|
||||
<font NAME="SansSerif" SIZE="16"/>
|
||||
|
|
@ -349,9 +341,7 @@
|
|||
<node CREATED="1684449367258" ID="ID_468772623" MODIFIED="1684449381475" TEXT="aber die Schachellung muß konsistent sein"/>
|
||||
<node CREATED="1684449381968" ID="ID_360672284" MODIFIED="1684449399174">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
dadurch entsteht eine <b>hierarchische Struktur</b>
|
||||
|
|
@ -383,9 +373,7 @@
|
|||
<node CREATED="1684371432720" ID="ID_1123773556" MODIFIED="1684371453578" TEXT="a sequence of Paragraphs"/>
|
||||
<node CREATED="1684372227175" ID="ID_821942243" MODIFIED="1684372243007" TEXT="(or other block-level elements)">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Images, Tables....
|
||||
|
|
@ -395,9 +383,7 @@
|
|||
</node>
|
||||
<node CREATED="1684371477714" ID="ID_513980953" MODIFIED="1684371513122">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
each <b>Paragraph</b>
|
||||
|
|
@ -408,9 +394,7 @@
|
|||
<node CREATED="1684371486953" ID="ID_1787404624" MODIFIED="1684371496582" TEXT="has content in several Runs"/>
|
||||
<node CREATED="1684372247214" ID="ID_1055426349" MODIFIED="1684372262902" TEXT="(or other inline elements)">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
embedded images, frames, embedded tables
|
||||
|
|
@ -420,9 +404,7 @@
|
|||
</node>
|
||||
<node CREATED="1684371497069" ID="ID_1839965384" MODIFIED="1684371506717">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
each <b>Run</b>
|
||||
|
|
@ -464,9 +446,7 @@
|
|||
<node CREATED="1684449843443" FOLDED="true" ID="ID_905162679" MODIFIED="1684524402788" TEXT="Programmiersprache">
|
||||
<node CREATED="1684449849914" ID="ID_1707614400" MODIFIED="1684450253394">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
eine <i>formale Sprache</i>
|
||||
|
|
@ -475,9 +455,7 @@
|
|||
</html></richcontent>
|
||||
<node CREATED="1684449862475" ID="ID_1076336004" MODIFIED="1684449884753">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
hat eine mathematisch präzise <b>Syntax</b> und <b>Semantik</b>
|
||||
|
|
@ -536,9 +514,7 @@
|
|||
</node>
|
||||
<node CREATED="1684524637068" ID="ID_1801335917" MODIFIED="1684524655521">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
um eine neue Instanz zu erzeugen,
|
||||
|
|
@ -547,8 +523,7 @@
|
|||
ruft man die "Konstruktor-Funktion auf"
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1684369795005" FOLDED="true" ID="ID_1730265194" MODIFIED="1684448598973" TEXT="Libraries">
|
||||
|
|
@ -561,9 +536,7 @@
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1684444895031" ID="ID_24582245" MODIFIED="1684444920548">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Modul <b>python-doxc</b>
|
||||
|
|
@ -581,9 +554,7 @@
|
|||
<node CREATED="1684448160291" ID="ID_1014538985" LINK="#ID_1369606274" MODIFIED="1684448204907" TEXT="Stylenamen werden in sichtbare Form übersetzt"/>
|
||||
<node CREATED="1684448234489" ID="ID_746702681" MODIFIED="1684448273543" TEXT="paragraph.text (Read/Write)">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Beim Schreiben wird der bestehende Content verworfen und durch einen einzigen Run ersetzt, der den gegebenen Text ohne weitere Formatierungen enthält
|
||||
|
|
@ -595,9 +566,7 @@
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1684444938400" ID="ID_1803428220" MODIFIED="1684444952121">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Modul <b>elementtree</b>
|
||||
|
|
@ -614,9 +583,7 @@
|
|||
<node CREATED="1684445240208" ID="ID_1228520062" LINK="https://stackoverflow.com/a/54788611" MODIFIED="1684445249673" TEXT="direkt per html.unescape"/>
|
||||
<node CREATED="1684445266182" ID="ID_40459638" MODIFIED="1684445290580">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<pre http-equiv="content-type" content="text/html; charset=utf-8" class="default s-code-block"><code class="hljs language-coffeescript">>>> from html import unescape
|
||||
>>> unescape('&quot;')
|
||||
|
|
|
|||
Loading…
Reference in a new issue