Coding issue with XML for word document

Deborah Swanson python at deborahswanson.net
Tue Feb 7 14:47:42 EST 2017


Cute, whoever you are. Very cute. (I know how to sign up for fake email
addresses too.)

> -----Original Message-----
> From: Python-list 
> [mailto:python-list-bounces+python=deborahswanson.net at python.o
> rg] On Behalf Of Deborah_Swanson at f38.n261.z1
> Sent: Monday, February 06, 2017 9:52 AM
> To: python-list at python.org
> Subject: Re: Coding issue with XML for word document
> 
> 
> From: "Deborah Swanson" <python at deborahswanson.net>
> 
> I don't see any Python in your code. The python.org list 
> isn't generally familiar with Microsoft proprietary code, 
> which is often quite different from other versions. Try 
> asking this question in Microsoft's Office/Word Document 
> forums. Good luck!
> 
> 
> accessnewbie at gmail.com wrote, on February 06, 2017 5:00 PM 
> Subject: Coding issue with XML for word document
> >
> >
> > I am constructing a sentence to insert into a word xml template. My 
> > code is below
> >
> > ------------------------
> > #Create a list
> >
> > if len(myList) > 0:
> >     if len(myList) > 1:
> >         testText = list_format(myList) + " dealers."
> >     else:
> >         myText = myList[0] + " dealer."
> >
> > #Contruct sentence
> >
> >     #myBlurb = "<w:cr/><w:r><w:rPr><w:b/></w:rPr><w:t>My
> > Favorite Cars - </w:t></w:r><w:r><w:t> My favorite cars are 
> available 
> > at </w:t></w:r>"  + myText + "<w:cr/>"
> >     myBlurb = "<w:cr/>My Favorite Cars - My favorite cars are 
> > available at " + myText + "<w:cr/>"
> > else:
> >     myBlurb = ""
> >
> >
> > -------------------------------------------
> >
> > If a list exists (not = 0) Then
> >
> > I am trying to get the following output:
> >
> > My Favorite Cars - My favorite cars are available at (list of
> > dealers) dealers.
> >
> > There is a newline above and below this line. The first three words 
> > and the dash are bold. All other words are regular.
> >
> > This works
> >
> > myBlurb = "<w:cr/>My Favorite Cars - My favorite cars are 
> available at 
> > " + myText + "<w:cr/>"
> >
> > But when I try to bold, it bombs. It does not seem to like 
> either of 
> > these (+ myText + "<w:cr/>") (separately or
> > together) appended on the end.
> >
> > Thia does not work
> >
> > myBlurb = "<w:cr/><w:r><w:rPr><w:b/></w:rPr><w:t>My Favorite Cars - 
> > </w:t></w:r><w:r><w:t> My favorite cars are available at 
> </w:t></w:r>"  
> > + myText + "<w:cr/>
> >
> > What am I missing here?
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list