Table text not hard against page margin

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Table text not hard against page margin

Post by bwofficer »

I am using a 2-column table to arrange the document information block at the start of a product note template with a PDF target.

I want the bones of the table to be invisible, with the left edges of the text that's inside the first column cells lining up exactly with the text above and below the table. When I build the target PDF, the text inside the table has shifted a gnat's whisker to the right. I've attached a screenshot of the PDF, zoomed in, so you can see what I mean. I've copied the text "REVISED BY" from the bottom left cell and pasted it as a standalone paragraph below the table so that the unwanted offset is more obvious. As you can see, the upright of the R in the first "REVISED BY" - the one that's inside the table - is a smidgen further right than the second "REVISED BY" below it (the one that's not in the table).

I'm only just learning the table aspects of CSS, but I thought I had set every border, margin, padding, etc. to zero for the table. I must have missed something, but I can't see what.

The CSS in my stylesheet is:

Code: Select all

table {
    border-collapse: collapse;
}
table, thead, tbody, tfoot, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
}
The paragraph doesn't have any left margin or padding either. The CSS for it is:
p {
margin: 9pt 0 0 0.5cm;
padding: 0 0 0 0;
}
Which has the left margin reset to zero by the class:
p.infoBlockText {
font-size: 10pt;
font-weight: normal;
text-transform: uppercase;
color: var(Black);
margin-left: 0;
margin-top: 0;
}

The XML from the table part of the topic file is:

Code: Select all

<table>
    <col style="width: 3cm;" />
    <col />
    <tbody>
        <tr>
            <td><p class="infoBlockText">Document type:</p></td>
            <td><p class="infoBlockText">Product Note</p></td>
        </tr>
        <tr>
            <td><p class="infoBlockText">Intended for:</p></td>
            <td><p class="infoBlockText">SUPPORT ENGINEERS, CUSTOMER PLANT SUPERVISORS</p></td>
        </tr>
        <tr>
            <td><p class="infoBlockText">Applicability:</p></td>
            <td><p class="infoBlockText">Name of product(s)</p></td>
        </tr>
        <tr>
            <td><p class="infoBlockText">Document ID:</p></td>
            <td><p class="infoBlockText">12345, Revision 1</p></td>
        </tr>
        <tr>
            <td><p class="infoBlockText">Original by:</p></td>
            <td><p class="infoBlockText">Initials, 9 March 2022</p></td>
        </tr>
        <tr>
            <td><p class="infoBlockText">Revised by:</p></td>
            <td><p class="infoBlockText">Initials, 30 march 2022</p></td>
        </tr>
    </tbody>
</table>
<p class="infoBlockText">Revised by:</p>
I'm obviously missing something, but I can't see what!
You do not have the required permissions to view the files attached to this post.
Psider
Propellus Maximus
Posts: 902
Joined: Wed Jul 06, 2011 1:32 am

Re: Table text not hard against page margin

Post by Psider »

Could there be a text-indent of a couple of pixels/points floating around somewhere in your stylesheet?
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Psider wrote:Could there be a text-indent of a couple of pixels/points floating around somewhere in your stylesheet?
None that I can see.

I have gone through the stylesheet thoroughly and deleted all the styles I'm not using. I've examined those styles that are left. I can't see anything in those styles that could cause the indent.
sarrantsvt
Propeller Head
Posts: 47
Joined: Mon Jun 28, 2021 8:02 am

Re: Table text not hard against page margin

Post by sarrantsvt »

Did you use your browser's Dev Tools and select the text to see what's getting applied?
Doing Online Help since 1990. I remember "dots" .........
Got a bug? https://www.madcapsoftware.com/feedback/bugs/
Got a suggestion? https://www.madcapsoftware.com/feedback ... quest.aspx
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

sarrantsvt wrote:Did you use your browser's Dev Tools and select the text to see what's getting applied?
The output is a PDF. This project, like all my projects so far, only has a print PDF target, with no online output at all.

All the relevant styles are inside the print media area of my stylesheet so even if I did try generating an online output, it wouldn't be using the same styles.

Is there an equivalent way of doing what you suggest for PDF outputs?
Psider
Propellus Maximus
Posts: 902
Joined: Wed Jul 06, 2011 1:32 am

Re: Table text not hard against page margin

Post by Psider »

I usually create a temporary stylesheet and use that for the web output to try to see what's happening. Not all pdf quirks translate to the web though, unfortunately.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Psider wrote:I usually create a temporary stylesheet and use that for the web output to try to see what's happening. Not all pdf quirks translate to the web though, unfortunately.
OK. Good idea. I guess I'd better see what this Dev Tools thing is and how to use it. I don't have a programming or web background at all. Digital electronics, yes. Radio systems, yes. Anything that requires looking at code, nope. Still, I've managed to get to grips with css over the last year, so it shouldn't be beyond me with a bit of reading up on it.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Table text not hard against page margin

Post by NorthEast »

I think it's highly likely that the small offset you see is just a glitch/bug in Flare's PDF generation, and not a problem in your CSS.
Try it starting with a new empty project and blank stylesheet, and you'll see exactly the same slight offset on table cells.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Dave Lee wrote:I think it's highly likely that the small offset you see is just a glitch/bug in Flare's PDF generation, and not a problem in your CSS.
Try it starting with a new empty project and blank stylesheet, and you'll see exactly the same slight offset on table cells.
If it does turn out to be a Flare PDF generator oddity, then I guess I can apply a negative left margin to the whole table to force it to line up, at least if the unwanted offset is consistent. I'd not be happy with that bodge, though. Laying out a table precisely is a pretty basic requirement for an authoring tool.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

I've just tried creating a table style using a table stylesheet rather than a regular stylesheet. Rather than dive into the CSS, I let Flare's TableStyle Editor do the heavy lifting. I set margins to 0, borders to none, padding to none, and separators to none.

There's still a mystery misalignment, but it's less. The text within the table is shifted right, but now by about only half the width of the upright of the letter R.

I can't really compare the two styles to see what's different. The first uses regular css. The second uses the MadCap specific css mcTableStyle, etc.
Psider
Propellus Maximus
Posts: 902
Joined: Wed Jul 06, 2011 1:32 am

Re: Table text not hard against page margin

Post by Psider »

The dev tools are pretty cool. There's a lot to take in initially, but it's pretty easy once you know what you're looking for.

Quick walkthrough.
I created a simple htm page (not in Flare) and opened it in Chrome. The other browser have similar tools, but may look and behave a little differently.

I right-clicked on the text "Document type" and selected Inspect from the popup menu. The dev tools opened and will look something like this:
Dev-tools.png
A. This is what I right-clicked on. It's selected by default.
B. The styles that apply to the selected element. I think it's most specific to least specific style. The strike-through in the p element says that the margin-bottom is being overridden by a more specific style (in this case, the margin on 'td p').
C. Styles that are inherited from a parent element.

You can click on other elements (for example the table element) and the right-panel will update with the styles relevent to the element you selected.

Hopefully that helps make sense of the info when you open the Dev tools. :)
You do not have the required permissions to view the files attached to this post.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Thank you, Psider - that's very helpful. It'll give me a head start trying out the Dev Tools.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

I tried looking at the styles being applied using Inspect in Chrome. It didn't show any unexpected margin or padding. So I've still no idea where this is coming from.

I ended up having to apply a -1px left margin to the whole table. That feels like a bit of a bodge but I guess it will have to do for now.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Table text not hard against page margin

Post by NorthEast »

bwofficer wrote:I tried looking at the styles being applied using Inspect in Chrome. It didn't show any unexpected margin or padding. So I've still no idea where this is coming from.
When I checked it previously in a PDF, I saw the same offset when starting off with an empty project and stylesheet.
You won't see the problem in the browser when viewing the PDF's temporary build files, so I'd assumed it's a glitch/bug in the PDF generation.

Either way, it's not an issue in your CSS, as it can be reproduced in an empty project.
I'd suggest reporting it as a bug to MadCap, and see what they say.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Dave Lee wrote:I'd suggest reporting it as a bug to MadCap, and see what they say.
I have reported it. In the meanwhile, I still need to counteract the offset in the project I'm working on, and applying a -1px left margin to the whole table is my stopgap solution.

It does mean I can't use table styles, though. After some experimentation I've discovered that Flare's regular stylesheets allow a negative left margin on table elements, but tablestyles only allow zero or positive margins.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

bwofficer wrote:Applying a -1px left margin to the whole table is my stopgap solution. It does mean I can't use table styles, though. After some experimentation I've discovered that Flare's regular stylesheets allow a negative left margin on table elements, but tablestyles only allow zero or positive margins.
I've just realised that I could maybe apply a negative left margin to the p.infoBlock style that formats the text inside the table. That might be cleaner.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Table text not hard against page margin

Post by NorthEast »

bwofficer wrote:It does mean I can't use table styles, though. After some experimentation I've discovered that Flare's regular stylesheets allow a negative left margin on table elements, but tablestyles only allow zero or positive margins.
It should work for both.

In the table stylesheet, just leave the margin as (not set) / Length:(default). Then it won't apply any margins, and will use whatever margin you set for table in your regular stylesheet.

Also, you can set inline margins on each table, so check the individual table properties are set to Align: (default), otherwise it'll apply an inline margin that overrides your stylesheet.
bwofficer
Propeller Head
Posts: 60
Joined: Tue May 12, 2020 2:16 am

Re: Table text not hard against page margin

Post by bwofficer »

Dave Lee wrote:It should work for both.

In the table stylesheet, just leave the margin as (not set) / Length:(default). Then it won't apply any margins, and will use whatever margin you set for table in your regular stylesheet.

Also, you can set inline margins on each table, so check the individual table properties are set to Align: (default), otherwise it'll apply an inline margin that overrides your stylesheet.
I'd rather not have some table styling in tablestyle sheets and some table styling in my regular stylesheet. That would be a recipe for getting muddled, at least for this particular bear of little brain.

What I've done is create a tablestyle called infoBlockLayoutTable using the TableStyle Editor. This style has no borders, no margins, no padding. Basically it's just an empty framework. I set it to use para style p.infoBlock for the cell content.

Then all I needed to do is include a 1px negative margin in the p.infoBlock style definition in my regular stylesheet. That worked a treat. Better than the MadCap support rep's suggestion of assigning a negative indent to the p.infoBlock style. Although I don't intend to have table entries longer than one line, I can't guarantee it.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Table text not hard against page margin

Post by NorthEast »

Gotcha - I'd only seen your first message when I replied, but it looks like you've got a simpler fix.
Post Reply