Cells filled with P tags in imported Word table

This forum is for all Flare issues related to importing files or projects.

Cells filled with P tags in imported Word table

Postby oremphelyn on Thu Nov 08, 2018 5:15 pm

Upon importing a Word document, every table cell is lined with unneeded P tags.

In Word, before importing the document to Flare, I assign the "Normal" style to all table text and verify that no inline formatting is applied to it. The content in the table cells are as plain vanilla as you can get.

In Flare, when preparing to import the Word file, I choose to carry over as few Word-specific styles as possible, mapping only a few critical ones like headings and body tags. On the Stylesheet tab, I choose "Don't preserve MS Word Styles" and I make sure "Convert inline formatting to CSS styles" is de-selected.

Yet, upon conversion Every. Single. Cell. of Every. Single. Table is lined with P tags, as shown below.

Code: Select all
<tr>
   <td>
      <p>Short Circuit Current Rating</p>
   </td>
   <td>
      <p>-30 to +70<span style="font-family: Symbol;">°</span> C</p>
   </td>
   <td>
       <p>Over Voltage Category</p>
   </td>
   <td>
      <p>0 to +40<span style="font-family: Symbol;">°</span> C</p>
   </td>
</tr>


This is completely unnecessary. It requires extra work editing the CSS declaration for every style used in a table to be sure the P tag within a table is ignored, or to manually remove all instances of P within TH and TD. The hundreds of instances of P tags and the required additional multiple declarations within the CSS file all contribute bloat to the entire project.

Code: Select all
<tr class="TableStyle-OpenTable-NoRules-Body-Body1">
   <td class="TableStyle-OpenTable-NoRules-BodyE-Column1-Body1">
      <p>Short Circuit Current Rating</p>
   </td>
   <td class="TableStyle-OpenTable-NoRules-BodyE-Column1-Body1">
      <p>-30 to +70<span style="font-family: Symbol;">°</span> C</p>
   </td>
   <td class="TableStyle-OpenTable-NoRules-BodyE-Column1-Body1">
      <p>Over Voltage Category</p>
   </td>
   <td class="TableStyle-OpenTable-NoRules-BodyD-Column1-Body1">
      <p>0 to +40<span style="font-family: Symbol;">°</span> C</p>
   </td>
</tr>


The unneeded P tags also cloud my view when I sometimes need to work using the Text Editor (code) view.

Has anyone found a way to prevent Flare from spawning P with TH or TD upon import?

TIA ~ Brian
oremphelyn
Jr. Propeller Head
 
Posts: 5
Joined: Tue Nov 06, 2018 4:44 pm

Re: Cells filled with P tags in imported Word table

Postby Curlyshell on Wed May 15, 2019 12:35 pm

I really, really, really, really wish someone would answer this question.
"I'm a technical writer, not a developer," she said.
Curlyshell
Propeller Head
 
Posts: 21
Joined: Fri Mar 01, 2019 9:14 am

Re: Cells filled with P tags in imported Word table

Postby SteveS on Wed May 15, 2019 3:20 pm

Just a thought...

Is there a return at the end of the cell's content in Word?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
SteveS
Propellus Maximus
 
Posts: 1973
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).

Re: Cells filled with P tags in imported Word table

Postby ChoccieMuffin on Thu May 16, 2019 4:36 am

No direct solution for you about how insanely ugly the resulting HTM is from a Word input, but you could possibly add a complex selector to your stylesheet so that td p is the same as td.
Started as a newbie with Flare 6.1, now using Flare 2019r1.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2075
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Cells filled with P tags in imported Word table

Postby Curlyshell on Thu May 16, 2019 5:46 am

SteveS wrote:Just a thought...

Is there a return at the end of the cell's content in Word?


Good question, but no—I did check that. Thanks for thinking of it.

I'm going to try @ChoccieMuffin's idea....
"I'm a technical writer, not a developer," she said.
Curlyshell
Propeller Head
 
Posts: 21
Joined: Fri Mar 01, 2019 9:14 am

Re: Cells filled with P tags in imported Word table

Postby doc_guy on Thu May 16, 2019 5:05 pm

We specifically tell Flare to create paragraph tags in our tables when the table is created.

Image

We want this because we want table cells with multiple paragraphs or images to have the same spacing as table cells with a single paragraph.

And yes, we use a complex selector for P's in a TD, so the style is just right.

So, in my opinion, this is a feature, not a bug. But I agree that not everybody will see it this way, and I believe it would be reasonable to give users the option when they import Word files.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1947
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Cells filled with P tags in imported Word table

Postby Curlyshell on Fri May 17, 2019 6:16 am

Thanks! I figured out how to activate that box (create a row or column and click it), and I changed the selector from <p> to none; but the <p> tag remains. I even went into the CSS file using Notepad++ and removed every P reference I could find, but the <p> tags remain in my output. Any suggestions?
"I'm a technical writer, not a developer," she said.
Curlyshell
Propeller Head
 
Posts: 21
Joined: Fri Mar 01, 2019 9:14 am

Re: Cells filled with P tags in imported Word table

Postby doc_guy on Fri May 17, 2019 10:58 am

Changing the CSS won't affect what elements are in your source topics. It will just affect how they are styled.

If you can, I'd revert the changes you made to your CSS. If you removed every instance of <p> style that you could find, you will have affected the style of all paragraphs in all situations. I don't think that is what you are trying to do.

The only way to remove that I'm aware of would be a find-and-replace. You'd want to use a regular expression to catch <p> tags that are inside <td> tags and remove the open <p> tag and leave the content alone and remove the closing </p> tag. I am not familiar enough with regular expressions to tell you how this would be accomplished, but this is the path that you'd want to go down.

I'd make sure you have a backup of your project before you do this, because find and replace in the code, *especially* with regular expressions can lead to unintended consequences.

Your other option is to just live with the <p> tags in tables. They are actually useful if you need multiple paragraphs or images or lists or whatever in your table cells. You can style them by adding a complex selector in your style sheet like this:
Code: Select all
td p {
    font-size:1em;
}


That will only affect <p> elements that are the child of <td> elements.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1947
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Cells filled with P tags in imported Word table

Postby doc_guy on Fri May 17, 2019 11:05 am

Daniel Ferguson just showed me a way to remove <p> tags on a table-by table basis:

1. In the structure bar, click the table element to select the entire table.
2. In the Table tab (on the Ribbon), click Cell Content Style.
3. In the pop-up window, select "None."

The <p> tags are removed, as long as there was only one paragraph in the cell. If there are multiple paragraphs in the cell, you're out of luck.

You can create a macro to simplify this process across multiple tables, so you'd just click the table tag, and then press your macro key combination to do the rest.

Again, this is courtesy of Daniel Ferguson of SmartOutput.com. He's a genius, really.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1947
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West


Return to Importing

Who is online

Users browsing this forum: No registered users and 2 guests