Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

word xml table 1

Status
Not open for further replies.

hyrogen

Programmer
Jul 10, 2003
60
GB
hi there,

Im using xml to create word documents, which include tables. However, Im needing to set the table height to be the full length of the page. Is there anyway to do this?

Many thanks in advance :)
 

You can't do it in Word. 'Page' is a transient construct, built at edit time using information from the current printer driver, not stored in the document. The best you can do is fix the height (absolutely) of each row such that the table will fit on the defined paper size, in the printer you use.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
thanks... hmmm, thats not really possible to set the row height, as the amount of content in the rows can vary vastly.

Is there a way of placing lines the whole length of the page? As I dont need lines horizontally, just vertically.
 
yeah thats right, they also need to overlay a table exactly
 
Doesn't xml allow you to define table cell borders?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
yes, but the problem is the table stops when the content ends, but i want the table to span the height of the page. As you said thats not possible, so i'll need a way of showing lines (ie the columns) down the whole page.
 
I am not getting this. The table stops as the content ends. But you want the table to continue - as blank cells past that end - for the entire height of the page. YET you do NOT want to use absolute heights of rows...because the content of the rows may vary. And you want vertical lines that overlay exactly the table...except for the part that may be after the table, if the table does not fill the page...as you want the table to span the page, regardless of anything that is in it.

Sorry, but I am having a heard time picturing this, and a VERY hard time trying to think of why anyone would want this.

I suggest you get Quark. Then you could sue xlm and have very precise control of the pages. Word does NOT have prcise control of pages, because as Tony mentioned, pages in Word are a transient, calculated, thing. They have no real existence per se.

Gerry
 
Sorry if I've not explained it very well.

Basically, Im producing a bill of sorts, where the column borders must run down the length of every page. However, the content, ie the lines of the bill may only go half way down the page.

Does that make any more sense?
 
But WHY must the column borders run down the length of page????

Gerry
 

If you want this on *every* page I would set the table without visible borders and put a background graphic in the header. The lines don't have to exactly match the table, just be close enough to not overwrite text, and you (presumably) know your page size even if Word doesn't. I have no idea how to do this in xml, though.


Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Gerry, the column borders must run the length of the page because it is for a legal document, and it has to match the precendents as closely as possible.

Tony, yeah thats what I though of doing, however, Im not sure how to define headers/footers in XML either.. Anyone got any clues?
 

There is probably more to it than this but I just created an empty document bar for a vertical line (of arbitrary length in an arbitrary position) in the header, and this seems to be the relevant portion of the XML.
Code:
<w:wordDocument ....

  <w:body>
    <wx:sect>
      :
      :
      <w:sectPr>

        <w:hdr w:type="odd">
          <w:p>
            <w:pPr>
              <w:pStyle w:val="Header"/>
            </w:pPr>
            <w:r>
              <w:rPr>
                <w:noProof/>
                <w:lang w:fareast="EN-GB"/>
              </w:rPr>
              <w:pict>
                <v:line id="_x0000_s1027"
                        style="position:absolute;z-index:1"
                        from="63pt,.6pt"
                        to="63pt,558.6pt"/>
              </w:pict>
            </w:r>
          </w:p>
        </w:hdr>

      </w:sectPr>
    </wx:sect>
  </w:body>
</w:wordDocument>
I presume you are working with the WordML definition and can understand more of this than I can.

I also note, after the header and footers, and inside the w:sectPr tag, a page definition ...
Code:
<w:pgSz w:w="11906"
        w:h="16838"/>
<w:pgMar w:top="1440"
         w:right="1800"
         w:bottom="1440"
         w:left="1800"
         w:header="708"
         w:footer="708"
         w:gutter="0"/>
<w:cols w:space="708"/>
<w:docGrid w:line-pitch="360"/>
At a guess I'd say the measurements were in twips (1440 to an inch).

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 

If I could find the time I'd study that more fully - it looks interesting. We'll have to learn together, so let's make sure I understand what you're trying to do.

You want to create a document - that much I'm sure is right [smile].
Part of your document is a table - but only part.
The document may contain other data.
The table may span several pages.
The pages with the table do *not* contain other data.
The pages with the table want to have vertical lines top to bottom, overlaying the table and any white space below.

The only immediate question I have - apart from wanting confirmation of the above - is: are you writing the WordML yourself or wanting to use a transform?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
I'll do my best to answer clearly :)

The document will only contain tables.
Im trying to create a legal bill which has different 'parts'
each new part needs to be on a new page, however any part maybe several pages long.
The header (column labels) must be on every page.
There has been a slight change in that, if a part ends half way down a page, the lines dont have to run down all the page. They can just stop.

Im using the technique of creating the docs from the site I mentioned, ie using xhtml.

BTW I've also tried using COM through php, which I got working although this was very slow hence the need for another method. I've also tried having a word doc which contains the header aleady setup, and doing a $range->InsertFile($tempWord); for the rest of the content generated in html. This works if I manually insert the html file through word its-self but not through the COM command from php? which is very strange.
 

Thank you.

Very quickly because I'm about to go out ...

If the lines only need to go as far down the page as the table does, then you can use table/cell borders which should be easier.

The referenced article didn't seem to give all the details. I'll need to read the WordML schema to see what you need. I'll try and do that tomorrow.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hi Tony,

thanks for your help. I've tried numerous things so far, and none sucessfuly, I've eventually decided on using this:


It seems to solve all my problems, as I can use the <tr header=yes> option to allow the first row of my table to be included on the next page if it rolls over. Plus if I do a pagebreak manually I can output the table header again myself. It has saved me loads of time messing with the WordML and is only 58USD.

Thanks very much though :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top