<?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[Excel und OLE]]></title><description><![CDATA[<p>Hallo Leute!!<br />
Ich habe folgendes Problem!!<br />
Ich will den Inhalt einer Excel Datei in StringGrid einlesen. StringGrid soll sich automatisch auf die Anzahl der Zeilen und Spalten einstellen. Das funktioniert auch soweit, bloß es werden nur 23 Zeilen eingelesen und eingestellt, obwohl ich in meiner Excel Datei knappe 1000 Zeilen habe!!!</p>
<pre><code class="language-cpp">if (OpenDialog_old-&gt;Execute()) {
	MSExcel = CreateOleObject(&quot;Excel.Application&quot;);
	XLWBooks = MSExcel.OlePropertyGet(&quot;Workbooks&quot;);
	XLWBooks.OleProcedure(&quot;Open&quot;, OpenDialog_old-&gt;FileName.c_str());
	XLWBook = XLWBooks.OlePropertyGet(&quot;Item&quot;, 1).OlePropertyGet(&quot;Worksheets&quot;).OlePropertyGet(&quot;Item&quot;, 1);
	XLWBooks = XLWBook.OlePropertyGet(&quot;Range&quot;, &quot;A1:CV100&quot;).OlePropertyGet(&quot;Value&quot;);

 	row_last = MSExcel.OlePropertyGet(&quot;ActiveCell&quot;).OlePropertyGet(&quot;Row&quot;);
	col_last = MSExcel.OlePropertyGet(&quot;ActiveCell&quot;).OlePropertyGet(&quot;Column&quot;);

	old_list-&gt;RowCount = row_last;
	old_list-&gt;ColCount = col_last;

 	for (int i=1; i &lt;= row_last; i++)
	{

		for (int j=1; j &lt;= col_last; j++)
		{
			old_list-&gt;Cells[j-1][i-1] = XLWBooks.GetElement(i, j);
		}

	}

	MSExcel.OlePropertySet(&quot;DisplayAlerts&quot;,false);
	MSExcel.OleProcedure(&quot;Quit&quot;);
	}
</code></pre>
<p>Kann mir jemand helfen??</p>
<p>Gruß Swunder</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/204535/excel-und-ole</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 16:11:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/204535.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Feb 2008 15:25:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Excel und OLE on Mon, 04 Feb 2008 15:27:42 GMT]]></title><description><![CDATA[<p>Hallo Leute!!<br />
Ich habe folgendes Problem!!<br />
Ich will den Inhalt einer Excel Datei in StringGrid einlesen. StringGrid soll sich automatisch auf die Anzahl der Zeilen und Spalten einstellen. Das funktioniert auch soweit, bloß es werden nur 23 Zeilen eingelesen und eingestellt, obwohl ich in meiner Excel Datei knappe 1000 Zeilen habe!!!</p>
<pre><code class="language-cpp">if (OpenDialog_old-&gt;Execute()) {
	MSExcel = CreateOleObject(&quot;Excel.Application&quot;);
	XLWBooks = MSExcel.OlePropertyGet(&quot;Workbooks&quot;);
	XLWBooks.OleProcedure(&quot;Open&quot;, OpenDialog_old-&gt;FileName.c_str());
	XLWBook = XLWBooks.OlePropertyGet(&quot;Item&quot;, 1).OlePropertyGet(&quot;Worksheets&quot;).OlePropertyGet(&quot;Item&quot;, 1);
	XLWBooks = XLWBook.OlePropertyGet(&quot;Range&quot;, &quot;A1:CV100&quot;).OlePropertyGet(&quot;Value&quot;);

 	row_last = MSExcel.OlePropertyGet(&quot;ActiveCell&quot;).OlePropertyGet(&quot;Row&quot;);
	col_last = MSExcel.OlePropertyGet(&quot;ActiveCell&quot;).OlePropertyGet(&quot;Column&quot;);

	old_list-&gt;RowCount = row_last;
	old_list-&gt;ColCount = col_last;

 	for (int i=1; i &lt;= row_last; i++)
	{

		for (int j=1; j &lt;= col_last; j++)
		{
			old_list-&gt;Cells[j-1][i-1] = XLWBooks.GetElement(i, j);
		}

	}

	MSExcel.OlePropertySet(&quot;DisplayAlerts&quot;,false);
	MSExcel.OleProcedure(&quot;Quit&quot;);
	}
</code></pre>
<p>Kann mir jemand helfen??</p>
<p>Gruß Swunder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449148</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Mon, 04 Feb 2008 15:27:42 GMT</pubDate></item><item><title><![CDATA[Reply to Excel und OLE on Mon, 04 Feb 2008 16:32:43 GMT]]></title><description><![CDATA[<p>diese Ziele beinhaltet aber nur 100 Zeilen:</p>
<pre><code>XLWBooks = XLWBook.OlePropertyGet(&quot;Range&quot;, &quot;A1:CV[b]100[/b]&quot;).OlePropertyGet(&quot;Value&quot;);
</code></pre>
<p>außerdem solltest du mal mit dem Debugger kontrollieren was bei row_last und col_last drinsteht, OlePropertyGet(&quot;ActiveCell&quot;) gibt nämlich <strong>nicht</strong> die letzte Zelle zurück, sondern die aktive, d.h. die Zelle die beim letzten Speichern markiert war</p>
<p>[Edit] schau dir mal <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39259-and-start-is-0-and-postdays-is-0-and-postorder-is-asc-and-highlight-is-.html" rel="nofollow">&quot;Excel - Beispiel und Wrapperklasse für Excelautomation&quot;</a> an, dort wird unter anderem auch der RowCount und ColCount ausgelesen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449184</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449184</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Mon, 04 Feb 2008 16:32:43 GMT</pubDate></item><item><title><![CDATA[Reply to Excel und OLE on Tue, 05 Feb 2008 08:52:50 GMT]]></title><description><![CDATA[<p>Ich würde einfach eine Schleife machen in der Du die Spalte A z.B. solange durchläufst, bis Du z.B. 5 aufeinanderfolgende Leerzellen gefunden hast und dann abbrechen.<br />
Das ganze dann zählen und dann weißte wie viele Datenzeilen Du hast.<br />
Bist dann deutlich flexibler.</p>
<p>Einziger Nachteil ist halt, dass Du Dir ne &quot;Grenze&quot; setzen musst, wann die Tabelle zu ende ist... in meinem Beispiel die 5.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1449510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1449510</guid><dc:creator><![CDATA[Errraddicator]]></dc:creator><pubDate>Tue, 05 Feb 2008 08:52:50 GMT</pubDate></item></channel></rss>