<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Import text files into preformatted word document in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328169#M25528</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I was over there prior to here but could not upload files and much of what I read seemed overwhelming. I was hoping for specific coding examples as I learn best by dissecting the code and working backwards. Probably an ADD thing. (But I will review webpage-thanks)&lt;BR /&gt;&lt;BR /&gt;I know it is not exactly an arcpy question and thus out-of-scope, but I figured since I created the real files by heavily relying on multiple geoprocessing results (see my other post for example) I could get away with it. (sheepish grin)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I seem to be doing a very similar thing to what you've done, and I now started building my python code for MS word manipulation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you get on top of it, and feel like sharing code and experience?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="mailto:galvine@npa.org.il"&gt;galvine@npa.org.il&lt;/A&gt;&lt;SPAN&gt; \\ &lt;/SPAN&gt;&lt;A href="mailto:galvine@gmail.com"&gt;galvine@gmail.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Gal&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2013 07:55:17 GMT</pubDate>
    <dc:creator>GalVine</dc:creator>
    <dc:date>2013-04-25T07:55:17Z</dc:date>
    <item>
      <title>Import text files into preformatted word document</title>
      <link>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328166#M25525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have this incredibly long python script that ultimately ends up with several text files (generated using ArcGIS 10.1) that I would like to import into a pre-formatted MS Word document/template. I want the files imported into the document and then displayed within MS Word for review.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can this be done? And if so, what approaches would you, the python gurus, recommend?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I attached some very small dummy sample files (Lou Gehrig speech for those baseball fans) in hopes that I could get some specific code examples to go by and then modify as I progress through the text file generation scripting process, which is on-going. Let???s assume files are kept in C:\Test. Using python 2.7. MS Word 2007.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you all in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Files included in attachment: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SampleInsertText.docx -&amp;nbsp; A sample of the MS Word 2007 template &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SampleResult.docx - A sample of the resulting word document after scripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;textfile1.txt - sample of 1st paragraph to be imported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;textfile2.txt - sample of 2nd paragraph to be imported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;textfile2.txt - sample of 3rd paragraph to be imported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;textfile2.txt - sample of 4th paragraph to be imported&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 16:28:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328166#M25525</guid>
      <dc:creator>StefaniGermanotta</dc:creator>
      <dc:date>2013-03-28T16:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Import text files into preformatted word document</title>
      <link>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328167#M25526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try reading through the following web page. It's where I got started when I wanted to read/write to word documents using python. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.galalaly.me/index.php/2011/09/use-python-to-parse-microsoft-word-documents-using-pywin32-library/"&gt;http://www.galalaly.me/index.php/2011/09/use-python-to-parse-microsoft-word-documents-using-pywin32-library/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a little out-of-scope for the ESRI website, so jumping over to Stack Overflow, you will find a ton of posts dealing with the same thing. basically, you can use the PyWin32 library of tools to learn how to write/format to MS Word. It's definitely a good python skill to have.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 16:35:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328167#M25526</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2013-03-28T16:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Import text files into preformatted word document</title>
      <link>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328168#M25527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Try reading through the following web page. It's where I got started when I wanted to read/write to word documents using python. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.galalaly.me/index.php/2011/09/use-python-to-parse-microsoft-word-documents-using-pywin32-library/"&gt;http://www.galalaly.me/index.php/2011/09/use-python-to-parse-microsoft-word-documents-using-pywin32-library/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This is a little out-of-scope for the ESRI website, so jumping over to Stack Overflow, you will find a ton of posts dealing with the same thing. basically, you can use the PyWin32 library of tools to learn how to write/format to MS Word. It's definitely a good python skill to have.&lt;BR /&gt;&lt;BR /&gt;Mike&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was over there prior to here but could not upload files and much of what I read seemed overwhelming. I was hoping for specific coding examples as I learn best by dissecting the code and working backwards. Probably an ADD thing. (But I will review webpage-thanks)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know it is not exactly an arcpy question and thus out-of-scope, but I figured since I created the real files by heavily relying on multiple geoprocessing results (see my other post for example) I could get away with it. (sheepish grin)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 17:02:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328168#M25527</guid>
      <dc:creator>StefaniGermanotta</dc:creator>
      <dc:date>2013-03-28T17:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Import text files into preformatted word document</title>
      <link>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328169#M25528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I was over there prior to here but could not upload files and much of what I read seemed overwhelming. I was hoping for specific coding examples as I learn best by dissecting the code and working backwards. Probably an ADD thing. (But I will review webpage-thanks)&lt;BR /&gt;&lt;BR /&gt;I know it is not exactly an arcpy question and thus out-of-scope, but I figured since I created the real files by heavily relying on multiple geoprocessing results (see my other post for example) I could get away with it. (sheepish grin)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I seem to be doing a very similar thing to what you've done, and I now started building my python code for MS word manipulation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you get on top of it, and feel like sharing code and experience?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="mailto:galvine@npa.org.il"&gt;galvine@npa.org.il&lt;/A&gt;&lt;SPAN&gt; \\ &lt;/SPAN&gt;&lt;A href="mailto:galvine@gmail.com"&gt;galvine@gmail.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Gal&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 07:55:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-text-files-into-preformatted-word-document/m-p/328169#M25528</guid>
      <dc:creator>GalVine</dc:creator>
      <dc:date>2013-04-25T07:55:17Z</dc:date>
    </item>
  </channel>
</rss>

