<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Создание файла config.xml, используя таблицу Excel.]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8696&amp;type=atom" />
	<updated>2013-09-25T03:08:45Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=8696</id>
		<entry>
			<title type="html"><![CDATA[Re: Создание файла config.xml, используя таблицу Excel.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=75543#p75543" />
			<content type="html"><![CDATA[<p>Спасибо. Да, по учебе.</p>]]></content>
			<author>
				<name><![CDATA[smax]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30820</uri>
			</author>
			<updated>2013-09-25T03:08:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=75543#p75543</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Создание файла config.xml, используя таблицу Excel.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=75533#p75533" />
			<content type="html"><![CDATA[<p>С использованием Microsoft.XMLDOM:<br /></p><div class="codebox"><pre><code>Sub ViaXMLDOM()
    Dim XMLDoc, Cell
    Set XMLDoc = CreateObject(&quot;Microsoft.XMLDOM&quot;)
    With XMLDoc.appendchild(XMLDoc.createElement(&quot;Signals&quot;))
        For Each Cell In Range(&quot;A2:A65536&quot;)
            If Cell.Value = &quot;&quot; Then Exit For
            With .appendchild(XMLDoc.createElement(&quot;Signal&quot;))
                .setAttribute &quot;Name&quot;, Cells(Cell.Row, 1).Value
                .setAttribute &quot;Type&quot;, Cells(Cell.Row, 3).Value
                With .appendchild(XMLDoc.createElement(&quot;Properties&quot;))
                    With .appendchild(XMLDoc.createElement(&quot;Property&quot;))
                        .setAttribute &quot;Name&quot;, &quot;Description&quot;
                        .setAttribute &quot;Type&quot;, &quot;String&quot;
                        .setAttribute &quot;Value&quot;, Cells(Cell.Row, 2).Value
                    End With
                    With .appendchild(XMLDoc.createElement(&quot;Property&quot;))
                        .setAttribute &quot;Name&quot;, &quot;Address&quot;
                        .setAttribute &quot;Type&quot;, &quot;UInt&quot;
                        .setAttribute &quot;Value&quot;, Cells(Cell.Row, 4).Value
                    End With
                    If Cells(Cell.Row, 5).Value &lt;&gt; Empty Then
                        With .appendchild(XMLDoc.createElement(&quot;Property&quot;))
                        .setAttribute &quot;Name&quot;, &quot;BitPosition&quot;
                        .setAttribute &quot;Type&quot;, &quot;Byte&quot;
                        .setAttribute &quot;Value&quot;, Cells(Cell.Row, 5).Value
                        End With
                    End If
                End With
            End With
        Next
    End With
    XMLDoc.Save ThisWorkbook.Path &amp; &quot;\config.xml&quot;
    Set XMLDoc = Nothing
    MsgBox &quot;Saved to &quot; &amp; ThisWorkbook.Path &amp; &quot;\config.xml&quot;
End Sub</code></pre></div><p>И кустарным методом:<br /></p><div class="codebox"><pre><code>Sub HandyCraft()
    Dim Cell, XMLText
    XMLText = &quot;&lt;Signals&gt;&quot; &amp; vbCrLf
    For Each Cell In Range(&quot;A2:A65536&quot;)
        If Cell.Value = &quot;&quot; Then Exit For
        XMLText = XMLText &amp; vbTab &amp; &quot;&lt;Signal Name=&quot;&quot;&quot; &amp; Cells(Cell.Row, 1).Value &amp; &quot;&quot;&quot; Type=&quot;&quot;&quot; &amp; Cells(Cell.Row, 3).Value &amp; &quot;&quot;&quot;&gt;&quot; &amp; vbCrLf &amp; vbTab &amp; vbTab &amp; &quot;&lt;Properties&gt;&quot; &amp; vbCrLf
        XMLText = XMLText &amp; vbTab &amp; vbTab &amp; vbTab &amp; &quot;&lt;Property Name=&quot;&quot;Description&quot;&quot; Type=&quot;&quot;String&quot;&quot; Value=&quot;&quot;&quot; &amp; Cells(Cell.Row, 2).Value &amp; &quot;&quot;&quot; /&gt;&quot; &amp; vbCrLf
        XMLText = XMLText &amp; vbTab &amp; vbTab &amp; vbTab &amp; &quot;&lt;Property Name=&quot;&quot;Address&quot;&quot; Type=&quot;&quot;UInt&quot;&quot; Value=&quot;&quot;&quot; &amp; Cells(Cell.Row, 4).Value &amp; &quot;&quot;&quot; /&gt;&quot; &amp; vbCrLf
        If Cells(Cell.Row, 5).Value &lt;&gt; Empty Then XMLText = XMLText &amp; vbTab &amp; vbTab &amp; vbTab &amp; &quot;&lt;Property Name=&quot;&quot;BitPosition&quot;&quot; Type=&quot;&quot;Byte&quot;&quot; Value=&quot;&quot;&quot; &amp; Cells(Cell.Row, 5).Value &amp; &quot;&quot;&quot; /&gt;&quot; &amp; vbCrLf
        XMLText = XMLText &amp; vbTab &amp; vbTab &amp; &quot;&lt;/Properties&gt;&quot; &amp; vbCrLf &amp; vbTab &amp; &quot;&lt;/Signal&gt;&quot; &amp; vbCrLf
    Next
    XMLText = XMLText &amp; &quot;&lt;/Signals&gt;&quot; &amp; vbCrLf
    With CreateObject(&quot;Scripting.FileSystemObject&quot;).CreateTextFile(ThisWorkbook.Path &amp; &quot;\config.xml&quot;, True)
        .Write (XMLText)
        .Close
    End With
    MsgBox &quot;Saved to &quot; &amp; ThisWorkbook.Path &amp; &quot;\config.xml&quot;
End Sub</code></pre></div><p><strong>smax</strong>, раскройте секрет,&nbsp; что за тесты?</p>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2013-09-24T19:54:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=75533#p75533</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Создание файла config.xml, используя таблицу Excel.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=75524#p75524" />
			<content type="html"><![CDATA[<p>Будьте добры, помогите. <br />Мне нужно написать скрипт VBA, который будет создавать файлик config.xml следующего формата, использую таблицу из excel.</p><p>Формат готового файла.<br />&lt;Signals&gt;<br />&lt;Signal Name=&quot;ZDV1_Open&quot; Type=&quot;Bool&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Задвижка 1 - открыта&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4001&quot; /&gt;<br />&lt;Property Name=&quot;BitPosition&quot; Type=&quot;Byte&quot; Value=&quot;0&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;ZDV1_Close&quot; Type=&quot;Bool&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Задвижка 1 - закрыта&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4001&quot; /&gt;<br />&lt;Property Name=&quot;BitPosition&quot; Type=&quot;Byte&quot; Value=&quot;1&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;ZDV2_Open&quot; Type=&quot;Bool&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Задвижка 2 - открыта&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4001&quot; /&gt;<br />&lt;Property Name=&quot;BitPosition&quot; Type=&quot;Byte&quot; Value=&quot;2&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;ZDV2_Close&quot; Type=&quot;Bool&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Задвижка 2 - закрыта&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4001&quot; /&gt;<br />&lt;Property Name=&quot;BitPosition&quot; Type=&quot;Byte&quot; Value=&quot;3&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;RES21_Temp&quot; Type=&quot;Float&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Температура в резервуаре 21&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4100&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;RES21_Level&quot; Type=&quot;Float&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Уровень в резервуаре 21&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4101&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;Signal Name=&quot;RES21_Speed&quot; Type=&quot;Float&quot;&gt;<br />&lt;Properties&gt;<br />&lt;Property Name=&quot;Description&quot; Type=&quot;String&quot; Value=&quot;Скорость наполнения в резервуаре 21&quot; /&gt;<br />&lt;Property Name=&quot;Address&quot; Type=&quot;UInt&quot; Value=&quot;4102&quot; /&gt;<br />&lt;/Properties&gt;<br />&lt;/Signal&gt;<br />&lt;/Signals&gt;</p>]]></content>
			<author>
				<name><![CDATA[smax]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30820</uri>
			</author>
			<updated>2013-09-24T08:15:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=75524#p75524</id>
		</entry>
</feed>
