Replies: 1   Views: 1199
Custom table styles: left and right cell margins are ignored
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Lochspring  · 16-08-2021 - 18:47

Hi there.  We're running PHPDocX 10, and running into a bit of a snag when trying to apply a table style that's embedded in the WORD document to out incoming content.  Our style is set with a cell margin of 0.5 in all the way around, top, bottom, left, and right.  If we manually apply the style in Word, it works flawlessly.  If we attach and apply it using WordStyles as part of embedHTML (or its wrapper function, replaceVariableByHTML), we lose the left and right margins on cells.

From searching the forums, what I've seen is that this is not uncommon.  Generally, what I've read is that there's a need to force those zeroed out values to be something else in HTML2WordML.php if you want to force the application of a value OTHER than 0 when you DON'T have CSS padding values being fed to the translator.  

The challenge, then, is how to extract the custom styles for Tables out of the base Word Template we start with.  Indexer does not seem to retrun the values in a useful way,or at least not in a way we can parse and see the results of our custom styles. 

So, I ask:  what is the most efficient way to get the cell margin values (left and right) from a given custom table style (e.g. CoolTableStyle).