On Thursday, February 21, 2013 2:12:12 PM UTC-8, WorkerBee wrote:
> Very new to python but diving in with both feet here. 
> 
> 
> 
> I am trying to extend a python script to include automating a response form 
> letter by including the results from a text file in tabular format into the 
> letter.
> 
> 
> 
> I have a text file called “Cities” that I want to add to a paragraph in 
> document. (It can be a text document. I can copy it into a word document 
> later)
> 
> 
> 
> The Cities.txt file looks like this:
> 
> 
> 
> "CITYNAME", Pop
> 
> "Master Chief", 4277647
> 
> "El Carro", 10017844
> 
> "Geat Stanton", 717804
> 
> "Eureka", 1973732
> 
> "Lands End",5329713
> 
> "Pembrook", 2751614
> 
> "White Park", 6854152
> 
> "Greenbriar", 3243175
> 
> "Lost Crutches", 1285470
> 
> "Storeybrook", 268888
> 
> "Burlington Heights City",10793
> 
> "Nyte", 11613743
> 
> "Dog Patch", 472314
> 
> "Miserable Lives", 2439334
> 
> "Lincoln Park Pirates", 6808633
> 
> "Son ofaFrancisco", 2295350
> 
> "Lois Lane Heights", 5178065
> 
> 
> 
> The first line is header info which will need to be renamed. The remaining 
> lines need to be entered as two columns but doubled up across the page. The 
> file will always be called cities but the data will change for each form 
> letter. Thus the cities could be 100 records long, or no cities found 
> depending on the search results. The table has to be 6.5 inches wide. Height 
> will vary. Thus for this file the data will need to look like this:
> 
> 
> 
> "Below is a list of the following cities that are within your area of 
> interest."
> 
> 
> 
> City Name     Population      City Name               Population
> 
> Master Chief  4277647         Storeybrook             268888
> 
> El Carro      10017844        Burlington Heights City 10793
> 
> Geat Stanton  717804          Nyte                    11613743
> 
> Eureka                1973732         Dog Patch               472314
> 
> Lands End     5329713         Miserable Lives         2439334
> 
> Pembrook      2751614         Lincoln Park Pirates    6808633
> 
> White Park    6854152         Son ofaFrancisco        2295350
> 
> Greenbriar    3243175         Lois Lane Heights       5178065
> 
> Lost Crutches 1285470         
> 
> 
> 
> (Note: No data would say something like: "There are no cities within your 
> area of interest." No table is inserted.)
> 
> 
> 
> Note that the city names sizes change so the column widths may need to change 
> also. My current process is to import the text file into Excel. Rename and 
> bold font headings and copy and paste second set of headings in columns 3 and 
> 4. Cut and paste half the rows into new columns below the second set of 
> headings. Copy and paste into word document. Auto fit table to window. 
> 
> 
> 
> I actually have several text files. Some require 1, 2 or 3 SETS of columns. I 
> figure if I can get coding for the above example, I can figure out how to 
> change it for all other text files.
> 
> 
> 
> I am trying to automate as much as the process as possible. Using python, I 
> have automated the processing required to get the text files, now I want to 
> try to automate putting this data into a standardized word document. 
> Basically I'm trying to automate a form letter that has a few modifications 
> depending on the query results. Can anyone help me here, if not with the 
> code, a site that would help me figure it out by myself?
> 
> 
> 
> BTW, I have NO control over the appearance of the form letter. A committee of 
> silly bureaucrats argued endlessly over the format last year and thus its 
> format is carved in stone. I just plug in the data like a good grunt worker 
> bee, so please refrain from slamming me on the ridiculousness of multiple 
> columns. Appearance is everything around here.
> 
> 
> 
> Thanks in advance.

Columns are supposed to line up. They lined up in my editor. Didn't see a 
preview/edit option so I had to post without using these features. Sorry.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to