none
Does DrawingML honor the HorizontalOverflow property of a TableCellProperties object? RRS feed

  • Question

  • Greetings

    I am writing a program to automate the creation of a DrawingML Table within a Powerpoint 2007 presentation. After the table is created, I need to go back into certain cells and add text annotations.

    My intention is for the text to overflow outside the cell's boundaries. To that end, in my code, I have set the HorizontalOverflow property of the TableCell's TableCellProperties object to Overflow; however, the text I provide in the table cell is wrapping within the cell, not flowing over the boundary as I expect and need.

    The document validates with the SDK, and the XML generated appears to be correct insofar as the actual overflow property being rendered within the tcPr. I don't know what else to check, or what I might be doing wrong that would prevent the text from overflowing.

    Any insights into this problem would be greatly appreciated.

    -David

     

    Wednesday, October 20, 2010 7:59 PM

All replies

  • It appears that you are setting the property correctly. The documentation at

    http://msdn.microsoft.com/en-us/library/cc845971.aspx

    horzOverflow (Horizontal Overflow)
     Specifies the clipping behavior of the cell. The two options here allow for the text to be clipped and out of view when outside of the bounds of the cell, or for the text to remain visible and overflow outside of the cell.
    [Example: Consider the following example:
    <a:tcPr horzOverflow="overflow">

    </a:tcPr>
     In this example, the text in the cell freely overflows outside of the cell boundaries and always remains visible. end example]
    The possible values for this attribute are defined by the ST_TextHorzOverflowType simple type (§20.1.10.69).

     A further description of the attribute at

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.bodyproperties.aspx

    says

    horzOverflow (Text Horizontal Overflow)
     Determines whether the text can flow out of the bounding box horizontally. This is used to determine what happens in the event that the text within a shape is too large for the bounding box it is contained within. If this attribute is omitted, then a value of overflow is implied.
    [Example: Consider the case where we have multiple paragraphs within a shape and the second is greater in length and causes text to flow outside the shape. By applying the clip value of the horzOverflow attribute as a body property this overflowing text now is cut off instead of extending beyond the bounds of the shape.
    <p:txBody>
    <a:bodyPr horzOverflow="clip" … />

    <a:p>

    (Some text)

    </a:p>
        <a:p>

    (Some more text)

    </a:p>
    </p:txBody>
     end example]
    The possible values for this attribute are defined by the ST_TextHorzOverflowType simple type (§20.1.10.69).

    The implication is the text flows as a straight line to the right of the edge of the cell.  Perhaps another explanation is that if you are inserting a paragraph, wrapping causes the paragraph to flow out of the bottom of the cell, or clip at the bottom border. The MSDN site explains the bounding box. Also, the text you insert needs to be defined as string type.

    If none of this information helps to resolve your issue please post a response, including a text block of the problem XML and a list of the steps to insert the DrawingML table into the PowerPoint slide.


    Chris Jensen
    Friday, November 5, 2010 6:42 PM
    Moderator
  • Chris,

    Thanks so much for taking the time to reply.

    I agree entirely with your interpretation of the relevant aspects of the MSDN references you cite.

    In my situation, the text I am programmatically placing in the TableCell is never clipped (in either direction), and always wraps.

    I then thought it might be educational to try creating a presentation slide with the behavior I need, and then use the XML Productivity Tool to reflect the proper code.

    To that end, I created a new Powerpoint 2007 presentation, drew a table onto the first slide of the presentation, and then attempted to select a single cell within the table in an effort to format it with the "Format Shape" context menu. Within that menu, in the "Text Box" option, I immediately noted that the "Wrap text in shape" option (beneath the "Internal Margin" section) is already checked, and is also disabled. That implied that text in a table cell within PowerPoint always wraps. I consulted another PowerPoint 2007 resource regarding this problem, and they confirmed independently that forcing text overflow in a PowerPoint table cell is not possible.

    The source code I am using to apply the HorizontalOverflow property for the TableCellProperties object of the applicable TableCell is excerpted from my application as follows:

     

    // currentCell is declared as a TableCell and is set in earlier code
    
    // sourceText is a simple String variable containing the text for the cell
    currentCell.TableCellProperties.HorizontalOverflow = TextHorizontalOverflowValues.Overflow;
    Paragraph cellParagraph = currentCell.TextBody.ChildElements.First<Paragraph>();
    cellParagraph.Append(new Run(new RunProperties(){ Language="en-US"
    , Dirty=false , SmartTagClean=false , FontSize=800},new Text(sourceText) ));

    The resultant XML for the slide indicates the Overflow property to have been properly applied in the <tcPr> element, and the text specified in the sourceText variable is located within the cell as expected. Everything about the generated content is correct - except that the text wraps within its containing cell even given the presence of the Overflow property for the TableCellProperties object. My conclusion from what I've been able to study and research from other sources is that the horizontal overflow property for the TableCellProperties object of the TableCell is simply ignored by PowerPoint 2007.

    Based on my experience having tried to accomplish the same result within the native PowerPoint 2007 application, it seems the programmatic results I have experienced are actually consistent. I believe PowerPoint 2007's behavior is not conformant to the Office Open XML specification in this regard.

    If you can offer any further insights or suggestions on this issue, I would be most appreciative.

    -David

     

     

     

     

     

     

    • Edited by soonerdave Friday, November 5, 2010 8:48 PM forum editor mangling code block...alas...
    Friday, November 5, 2010 8:39 PM
  • Thank you for the comprehensive reply and the steps you use to set the cell properties. I have the same experience with PowerPoint 2010, and with the cell in a table inserted in a Word 2010 document. The only approach that worked for me was to insert a textbox control into the cell. The text flowed out of the bounds of the textbox and across the tableCell boundaries without wrapping. The relevant XML I used is:

            <p:txBody>

              <a:bodyPr wrap="none" rtlCol="0">

                <a:noAutofit />

              </a:bodyPr>

              <a:lstStyle />

              <a:p>

                <a:r>

                  <a:rPr lang="en-US" dirty="0" smtClean="0" />

                  <a:t>This is a really </a:t>

                </a:r>

                <a:r>

                  <a:rPr lang="en-US" dirty="0" err="1" smtClean="0" />

                  <a:t>really</a:t>

                </a:r>

    Try this as a workaround, and please post a comment as to whether this solves your problem.  Thanks.


    Chris Jensen
    Monday, November 15, 2010 9:24 PM
    Moderator
  • Chris,

     

    Thank you very much for your reply. I just received the notification that you had posted this, and I will try it as soon as possible and reply with my results. 

     

    Many thanks, and I will follow up as soon as I can.

    Regards,

    David

     

    Tuesday, November 16, 2010 12:06 AM
  • Chris,

    I have attempted to implement the recommended solution you provided, at least in a limited way. I plan to do a bit more testing later.

    The first problem I am having is that I notice the namespace prefix for the txBody tag in your sample is, I believe, taken from the "PresentationML" namespace. All the txBody tags in my XML (even that generated by Powerpoint itself) draw from the DrawingML namespace. On a preliminary test (one that I want to take additional time to verify, but wanted to at least advise where I was on the issue), I added  the <a:noAutoFit /> tag and the 'wrap="none" attribute to the <a:bodyPr> tag, but doing so causes the document to fail validation an an "invalid child element." Powerpoint reports the presentation to be corrupt.

    Again, these are preliminary results and I am going to verify that I have added the XML you provided properly and continue attempting to apply your recommendations.

    I will advise as soon as I have more information.

    -David

     

    Tuesday, November 16, 2010 9:31 PM
  • Chris,

    I was able to confirm that I was implementing the solution you provided in the XML, and am able to confirm that it is not passing validation.

    When I use the Open Office XML Productivity Tool to examine the file once I've applied the edits, it reports validation failure at the very point at which I have added the PresentationML txBody tag within the table cell. It specifically indicates the only valid element allowed within the TC tag is a DrawingML txBody tag.

    I thought perhaps this was working in PowerPoint 2010 due to a change in the schemas, so I then attempted to have the Productivity tool validate the XML using the PowerPoint 2010 schema, but the validation failure persists within the TableCell.

    -David

     

     

    Tuesday, November 16, 2010 9:56 PM
  •  

    Dear David,

    Your issue falls into the paid support category which requires a more in-depth level of support.  Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

     

     


    Chris Jensen
    • Proposed as answer by cjatmsModerator Thursday, November 18, 2010 3:55 PM
    Thursday, November 18, 2010 3:55 PM
    Moderator