<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Word automation mit Word_2K_SRVR]]></title><description><![CDATA[<p>Ich bin am verzweifeln.<br />
Ich möchte aus meiner Applikation heraus ein Word Dokument erstellen. Dabei bin ich auf die Komponenten TWordApplication, TWordDocument etc. gestoßen.<br />
Scheinbar arbeitet niemand damit, sonst wären bestimmt irgendwo Beispiele verfügbar. Nachdem ich nun schon Text ausgeben und formatieren kann wollte ich eine Tabelle einfügen.</p>
<pre><code class="language-cpp">[code]
	// Dokument öffen
	WdApp-&gt;Documents-&gt;Add(Template, NewTemplate, myDocTyp, isVisible);
	WdDoc-&gt;ConnectTo(WdApp-&gt;Documents-&gt;Item(ItemIndex));
	// Seite einrichten
	WdDoc-&gt;PageSetup-&gt;LeftMargin   = WdApp-&gt;MillimetersToPoints(25);
	WdDoc-&gt;PageSetup-&gt;RightMargin  = WdApp-&gt;MillimetersToPoints(25);
	WdDoc-&gt;PageSetup-&gt;TopMargin    = WdApp-&gt;MillimetersToPoints(20);
	WdDoc-&gt;PageSetup-&gt;BottomMargin = WdApp-&gt;MillimetersToPoints(20);

	// Überschrift zentriert
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) true;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignRowCenter;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 18;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (&quot;Maschinenoptionen Software\n&quot;));

	// 2. Überschrift etwas kleiner
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) false;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 14;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignRowCenter;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (&quot;Elektronikentwicklung\n&quot;));

	// Absatz mit speziellen Tabulatoren
	Leader    = wdTabLeaderSpaces;
	Alignment = wdAlignTabLeft;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;ClearAll();
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(20), Alignment,Leader);
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(90),Alignment,Leader);
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(110),Alignment,Leader);
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) false;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 10;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignParagraphLeft;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (AnsiString(&quot;|Kunde:\t&quot;) + &quot;|Überschrift&quot; +&quot;\t|Komm-Nr.:\t&quot; + &quot;|991234&quot; + &quot;\n&quot;));

	// so, nun soll hier eine Tabelle von 3x3 Zellen eingefügt werden
	WdDoc-&gt;Tables-&gt;Add(WdApp-&gt;Selection-&gt;Range, (long) 3, (long) 3, wdWord8TableBehavior, wdAutoFitFixed);
	WdDoc-&gt;Tables-&gt;Add(WdDoc-&gt;Content, 3, 3, wdWord8TableBehavior, wdAutoFitFixed);
</code></pre>
<p>[/code]</p>
<p>Beim einfügeversuch erscheint die Meldung:<br />
HRCHECK: 'this-&gt;Add(Range, NumPows, NumColumns, DefaultTableBehavior, AutoFitBehavior, (Word_2K::Table**)&amp;prop)': An den Stub wurde ein Nullzeiger übergeben.</p>
<p>Wo kommt dieser 6. Parameter her ? Was ist ein Stub ?<br />
Geht das alles viel einfacher ?</p>
<p>Natürlich ziehe ich auch die VBAWRD9.CHM Hilfe zu Rate. Aber die ist wohl nur was für Insider, nicht für jemanden, der sich hier einarbeiten muss.<br />
Hoffentlich hat jemand hier Hinweise für mich.<br />
Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/169213/word-automation-mit-word_2k_srvr</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 14:41:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/169213.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jan 2007 10:14:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Word automation mit Word_2K_SRVR on Wed, 03 Jan 2007 10:14:12 GMT]]></title><description><![CDATA[<p>Ich bin am verzweifeln.<br />
Ich möchte aus meiner Applikation heraus ein Word Dokument erstellen. Dabei bin ich auf die Komponenten TWordApplication, TWordDocument etc. gestoßen.<br />
Scheinbar arbeitet niemand damit, sonst wären bestimmt irgendwo Beispiele verfügbar. Nachdem ich nun schon Text ausgeben und formatieren kann wollte ich eine Tabelle einfügen.</p>
<pre><code class="language-cpp">[code]
	// Dokument öffen
	WdApp-&gt;Documents-&gt;Add(Template, NewTemplate, myDocTyp, isVisible);
	WdDoc-&gt;ConnectTo(WdApp-&gt;Documents-&gt;Item(ItemIndex));
	// Seite einrichten
	WdDoc-&gt;PageSetup-&gt;LeftMargin   = WdApp-&gt;MillimetersToPoints(25);
	WdDoc-&gt;PageSetup-&gt;RightMargin  = WdApp-&gt;MillimetersToPoints(25);
	WdDoc-&gt;PageSetup-&gt;TopMargin    = WdApp-&gt;MillimetersToPoints(20);
	WdDoc-&gt;PageSetup-&gt;BottomMargin = WdApp-&gt;MillimetersToPoints(20);

	// Überschrift zentriert
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) true;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignRowCenter;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 18;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (&quot;Maschinenoptionen Software\n&quot;));

	// 2. Überschrift etwas kleiner
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) false;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 14;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignRowCenter;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (&quot;Elektronikentwicklung\n&quot;));

	// Absatz mit speziellen Tabulatoren
	Leader    = wdTabLeaderSpaces;
	Alignment = wdAlignTabLeft;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;ClearAll();
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(20), Alignment,Leader);
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(90),Alignment,Leader);
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;TabStops-&gt;Add(WdApp-&gt;MillimetersToPoints(110),Alignment,Leader);
	WdApp-&gt;Selection-&gt;Font-&gt;Bold = (int) false;
	WdApp-&gt;Selection-&gt;Font-&gt;Size = 10;
	WdApp-&gt;Selection-&gt;Paragraphs-&gt;Alignment = wdAlignParagraphLeft;
	WdApp-&gt;Selection-&gt;TypeText((Variant) (AnsiString(&quot;|Kunde:\t&quot;) + &quot;|Überschrift&quot; +&quot;\t|Komm-Nr.:\t&quot; + &quot;|991234&quot; + &quot;\n&quot;));

	// so, nun soll hier eine Tabelle von 3x3 Zellen eingefügt werden
	WdDoc-&gt;Tables-&gt;Add(WdApp-&gt;Selection-&gt;Range, (long) 3, (long) 3, wdWord8TableBehavior, wdAutoFitFixed);
	WdDoc-&gt;Tables-&gt;Add(WdDoc-&gt;Content, 3, 3, wdWord8TableBehavior, wdAutoFitFixed);
</code></pre>
<p>[/code]</p>
<p>Beim einfügeversuch erscheint die Meldung:<br />
HRCHECK: 'this-&gt;Add(Range, NumPows, NumColumns, DefaultTableBehavior, AutoFitBehavior, (Word_2K::Table**)&amp;prop)': An den Stub wurde ein Nullzeiger übergeben.</p>
<p>Wo kommt dieser 6. Parameter her ? Was ist ein Stub ?<br />
Geht das alles viel einfacher ?</p>
<p>Natürlich ziehe ich auch die VBAWRD9.CHM Hilfe zu Rate. Aber die ist wohl nur was für Insider, nicht für jemanden, der sich hier einarbeiten muss.<br />
Hoffentlich hat jemand hier Hinweise für mich.<br />
Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1201678</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1201678</guid><dc:creator><![CDATA[MyOwnShadow]]></dc:creator><pubDate>Wed, 03 Jan 2007 10:14:12 GMT</pubDate></item></channel></rss>