Word adding paragraph spacing on inserted rows

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Word adding paragraph spacing on inserted rows

Post by FeeMaher »

I have a frustrating problem that every so often will not sort itself out. I need to use a lot of tables in my printed output. To begin with I had some cells with padding and some cells without. I managed to figure out that some cells had paragraph items and some didn't. I created a 'cell top' and 'cell bottom' p. style to avoid additional spacing above/below text within a cell.
This all works fine if there are no rows inserted into an established table. However, when proof reading, I often find I need to add a row, and the paragraph spacing issue starts again.
I have all rows behaving, except for the inserted one (see image below). The inserted row has the same settings as every other row.
I have even taken the XML code from the row below, and used it on the problematic row - so the code is EXACTLY the same for both rows, but Word still interprets the inserted row differently (In Word, the inserted row has spacing before and after the paragraph text in the cells).

Has anyone had a similar issue? Or knows a trick to get the row to behave?
Word inserted row.png
XML Inserted row.png
You do not have the required permissions to view the files attached to this post.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Word adding paragraph spacing on inserted rows

Post by ChoccieMuffin »

I think I might have spotted what's going on.

In some of your rows, your <td> contains a <p>, in others the content is directly inside the <td>. What is happening is the spacing you've defined after your <p> comes into play, hence the space. And I suspect it's the padding rather than the margin that is making the space.

To fix it in your stylesheet (so you don't have to add inline styling every time) add something like this:

td p
{
padding-bottom: 0;
margin-bottom: 0;
}

What this does is it specifies that any p inside a td doesn't have a space after (no matter what is defined for a regular <p>)

A useful resource that might explain it in a bit more detail is https://www.w3schools.com/cssref/css_selectors.asp, so do have a browse round the Reference section and see what you can learn - an interesting use for a spare half hour.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Re: Word adding paragraph spacing on inserted rows

Post by FeeMaher »

Thanks @ChoccieMuffin. I should have mentioned - the other cells using a paragraph are behaving. I tried adding the <p> to the problematic row, and again - behaving differently to the other rows that contain paragraphs. It's probably some obscure bug that only I have made happen by building the table in a specific way.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Word adding paragraph spacing on inserted rows

Post by ChoccieMuffin »

I notice that there's more space at the top as well as at the bottom of the paragraph.

If you generate a web page from this topic, what can you see in the underlying code around that table cell? That might give you a hint.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Re: Word adding paragraph spacing on inserted rows

Post by FeeMaher »

Great investigation strategy - thanks!
Gene K
Propeller Head
Posts: 28
Joined: Mon Apr 13, 2020 1:56 pm

Re: Word adding paragraph spacing on inserted rows

Post by Gene K »

I don't know if you've solved this already, but if the spacing before/after a paragraph occurs when you insert a new row in Word then I would assume that it is Word adding the extra spacing. Word has its own styling, and it may be adding something that overrides whatever you've done in Flare.

Checking if Word is the problem:
  1. In Word, place the editing cursor inside the offending table cell paragraph to select it.
  2. On the Page Layout tab, check the Spacing Before/After settings, and change them to 0 pt if needed.
If that fixes the spacing behavior, then you know Word is the problem and can fix new rows the same way whenever you add them in Word. That said, if you find yourself fighting with Word often it could be worth your while to create a custom Word template to automate these corrections for you. That's a bit more of an involved process, though, and I don't even know if it's relevant to your issue so I'm skipping writing that out for now. If it would be helpful, shoot me a message and I can put the time into it.
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Re: Word adding paragraph spacing on inserted rows

Post by FeeMaher »

Hi Gene,

That's exactly what's happening. Word is inserting a space before and after on the paragraph within the cell (I already knew that was happening - but I assumed it was a setting in Flare that I missed that was doing it).
For now there is only one row that has the issue, so I've been manually fixing it when I publish the file (along with a few other annoying things that Word takes upon itself to do). The template to automate the fixes is a good idea. I hadn't done this initially as I didn't want a macro in the file I provide to a client (it gives them a nasty warning when they open it). But if I use a template and 'save as' I'm assuming there is a way to drop the macro?

Thanks for your insight - I'm glad it's not something I have done ;-)
Gene K
Propeller Head
Posts: 28
Joined: Mon Apr 13, 2020 1:56 pm

Re: Word adding paragraph spacing on inserted rows

Post by Gene K »

FeeMaher wrote:Hi Gene,

That's exactly what's happening. Word is inserting a space before and after on the paragraph within the cell (I already knew that was happening - but I assumed it was a setting in Flare that I missed that was doing it).
For now there is only one row that has the issue, so I've been manually fixing it when I publish the file (along with a few other annoying things that Word takes upon itself to do). The template to automate the fixes is a good idea. I hadn't done this initially as I didn't want a macro in the file I provide to a client (it gives them a nasty warning when they open it). But if I use a template and 'save as' I'm assuming there is a way to drop the macro?

Thanks for your insight - I'm glad it's not something I have done ;-)
Hi Fee,

I'm glad the info was useful!

While I don't know what other fixes you need to do, there's no need to get macros involved to use a template for changing paragraph spacing. You can save the template as .dotx (non-macro template). Then, link any future outputs (.docx) to the template file, enable automatic style updates, save them once, and send them off to clients normally.

Writing out illustrated instructions in-message for how to do that proved to be too finicky, (especially with how tangled the output styles are). I prepared a separate guide to upload as an attachment, but I've hit a roadblock in the form of a 500 KiB size limit right at the end of the day. I'll see if I can trim it down a bit and upload it tomorrow.
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Re: Word adding paragraph spacing on inserted rows

Post by FeeMaher »

Wow Gene thanks so much! It sounds like I will need to know the styles created by Flare in the Word doc? I am confident I will know how to do it, I just need some info about how to get the style to remove the paragraph spacing. From memory, once published it Word, there is actually a different style on the 'problematic' paragraph in the table row (something like 'style1' instead of 'style'). That's why I was thinking I would need a macro to change the style in all the tables to the same style.

FYI - Below are the other annoying issues (just in case you know a quick fix - or the automatic style setting may fix. But please don't feel like you need to provide a solution).
  • Table of contents right alignment tab for page numbers only 3/4 across the page - it's a known issue with Word that Madcap are not worried about (support's reply was there will always be little things to fix when publishing to Word). We've tried everything (within Flare) with no luck. I have to highlight the entire TOC (sometimes 3 or 4 pages long), then drag the right align tab marker over to the right margin. This may be a good candidate for the automatic style setting.
  • Resize logo image in the header of normal pages - I have to manually resize it to be smaller. No matter what size I set it to in Flare or Capture, it won't go smaller than the current publish size (I even tried tiny - 1cm x 1cm) - it publishes to the current size. When playing around with it, I can make it bigger, then slightly smaller (but bigger than the current publish size), but as soon as I hit a certain size - it will not go smaller. This is another thing a macro would fix ;-)
Thanks again for your help. Eternally grateful!!
Cheers.
Gene K
Propeller Head
Posts: 28
Joined: Mon Apr 13, 2020 1:56 pm

Re: Word adding paragraph spacing on inserted rows

Post by Gene K »

Hi Fee,
FeeMaher wrote:It sounds like I will need to know the styles created by Flare in the Word doc? I am confident I will know how to do it, I just need some info about how to get the style to remove the paragraph spacing. From memory, once published it Word, there is actually a different style on the 'problematic' paragraph in the table row (something like 'style1' instead of 'style'). That's why I was thinking I would need a macro to change the style in all the tables to the same style.
Yes, you'll definitely need to know which Word styles (created by Flare) are affected. However, it's strange that Word changes the style when you insert a new row. When I insert new rows in my test tables, Word uses the same original style as you'd expect. It's worth noting that Flare does create separate td styles by default. I can't quite nail down all the criteria based on the naming conventions, but as far as I can tell:
  • 1 new style per table column.
  • 1 new style whenever a row/column has CSS differences.
For example, I created a test table with a 2 column 3 row body.
  • With default styling, Flare creates 2 td styles.
  • When I remove the outside borders from the table in my stylesheet, there are now 4 td styles (the 2 from before, +2 for the last row where the bottom border is missing).
You'll need to check this on your end. If Word is simply changing to a different pre-existing style created by Flare, the template solution should still work. If Word is creating a new style for some arcane reason, the template may not help you (because it relies on modifying the affected styles to match, which doesn't work if Word creates a new style again).
FeeMaher wrote:
  • Table of contents right alignment tab for page numbers only 3/4 across the page - it's a known issue with Word that Madcap are not worried about (support's reply was there will always be little things to fix when publishing to Word). We've tried everything (within Flare) with no luck. I have to highlight the entire TOC (sometimes 3 or 4 pages long), then drag the right align tab marker over to the right margin. This may be a good candidate for the automatic style setting.
It might be easier to just exclude Flare's TOC from your Word output entirely, and insert Word's own implementation of generated TOC instead (References tab → Table of Contents → Custom Table of Contents). This would probably play nicer with any potential updates to the TOC as well.

Assuming the template solution will actually help you, you can definitely customize Word's TOC styles in the template and have those changes apply automatically when you insert the table.
FeeMaher wrote:
  • Resize logo image in the header of normal pages - I have to manually resize it to be smaller. No matter what size I set it to in Flare or Capture, it won't go smaller than the current publish size (I even tried tiny - 1cm x 1cm) - it publishes to the current size. When playing around with it, I can make it bigger, then slightly smaller (but bigger than the current publish size), but as soon as I hit a certain size - it will not go smaller. This is another thing a macro would fix ;-)
Hm. Is your logo a vector graphic? I've been running into an issue where no matter what I do settings-wise the only way I can successfully resize vector graphics in print outputs is by changing their default "dimensions" in an actual vector editor (Inkscape in my case). You *could* try creating a separate copy of the logo sized exactly how you want it for Word output, but I'd be the first to agree that this is not an ideal solution...

If you find that using macros is ultimately your best option, I *believe* that re-saving the document in a non-macro enabled format should remove the security warning like you mentioned previously. That said, I don't have much experience with Word macros so I'm just assuming that you wouldn't need to keep macros enabled after making your edits.
FeeMaher wrote: Thanks again for your help. Eternally grateful!!
Cheers.
You're welcome; I'm glad I was able to actually *be* helpful. :D

I've attached my illustrated guide in case you can still use it. Unfortunately, there are some complications:
  • The only file format I can save to that meets the size limit (< 500 KiB) is PDF.
  • PDF attachments are blocked due to security vulnerabilities in the file format.
I changed the file extension to .txt to attach it; if you change the extension back to .pdf it should open correctly. I promise I haven't injected any malicious code/scripts/whatever into it (wouldn't know how even if I wanted to), but if you're worried you can find most of the pertinent information here:

https://wordribbon.tips.net/T005998_Cha ... plate.html

Just make sure you tick the "automatically update document styles" option when you attach the template. This will make it so that any style changes you make in the Template automatically re-apply to your document when you save it. The only major caveat being you need to make style changes in the *Template* not the document (or else the template will overwrite your document changes whenever you save.

Good luck!
You do not have the required permissions to view the files attached to this post.
FeeMaher
Propeller Head
Posts: 20
Joined: Thu Sep 12, 2019 9:35 pm
Location: Melbourne, Australia

Re: Word adding paragraph spacing on inserted rows

Post by FeeMaher »

Wow Gene! Awesome effort! I will have a play around with this over the next few weeks and report back.

Cheers!
Post Reply