CSS property for adding text to a style, like "NOTE:"

This forum is for all Flare issues related to styles, stylesheets and XML.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: CSS property for adding text to a style, like "NOTE:"

Post by NorthEast »

mattf wrote:david,
I had done mine pretty much the exact same way, though I had been chagrined that I couldn't get the word Note or Tip to be bold. After I saw your post I added your "mc-auto-number-class: bold;" line to my .css but the bold does not show up either in ouput or in the Flare editor. Did that work for you?
Matt
Have you looked at the formatting options in the stylesheet editor?

Open the style in the stylesheet editor and click on the mc-auto-number-format property.
The Auto-Number Format window appears, and from here you can apply all sorts of formatting.
To see the formatting options, select Show Format Commands from the list.

For example, adding bold formatting to your style would be:

p.note
{
mc-auto-number-format: '{b}NOTE: {/b}';
}
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

For example, adding bold formatting to your style would be:

p.note
{
mc-auto-number-format: '{b}NOTE: {/b}';
}
Wow, that's trippy. I'll give that a try tomorrow. I tried "other David"'s trick about using "mc-auto-number-class: bold" and it didn't work. I mean it TOOK it, even showed it in the stylesheet editor, but it didn't have any effect.

I'll let you know how this works.
Matt F
You learn something new every day if you're not careful.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: CSS property for adding text to a style, like "NOTE:"

Post by NorthEast »

Both ways work, although the auto-number-class method needs more detail than was provided.

When you set the mc-auto-number-class property, what you're doing is saying that the autonumber section will be contained within in a span tag of that class.

So, if you set mc-auto-number-class:noteformat, then you'd need to also set up the span class span.noteformat.
(I'm assuming the other David set up a span class span.bold)

E.g. to make the note bold using this method:

Code: Select all

p.note
{
	mc-auto-number-format: 'Note: ';
	mc-auto-number-class: noteformat;
}

span.noteformat
{
	font-weight: bold;
}
This method is fine if the format applies to the whole content of the auto-number (i.e. "Note: "). If you need to change formatting within the auto-number content itself, then you need to use the the formatting method that I mentioned in my last post.
davidgolden99
Propeller Head
Posts: 29
Joined: Thu Apr 10, 2008 11:17 am

Re: CSS property for adding text to a style, like "NOTE:"

Post by davidgolden99 »

Dave Lee wrote: (I'm assuming the other David set up a span class span.bold)
That's exactly what I did. Then I saw that was possible to set up the bold in the autonumbering dialog box with curly braces {b}NOTE:{/b} -- or use the other method described above.
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

Whoohoo!! The curly braces things worked. Yeah!!! When life is good, it's really good.

Thanks Dave and David! I'm off to create my Tip, Caution, and Warning styles...maybe even Danger!

:D
Matt F
You learn something new every day if you're not careful.
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

I should have known it was too good to be true. :cry:

The {b}{/b} tags show in the printed output. Guess it's back to the drawing board.
Matt F
You learn something new every day if you're not careful.
SteveS
Senior Propellus Maximus
Posts: 2087
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).
Contact:

Re: CSS property for adding text to a style, like "NOTE:"

Post by SteveS »

mattf wrote:I should have known it was too good to be true. :cry:

The {b}{/b} tags show in the printed output. Guess it's back to the drawing board.
Its a pain, to be sure.

After I blogged on autonumbering, Doc Guy pointed out that the method I was using didn't work exactly as planned - the bold format didn't make it to word. Beacause I was using colour to highlight the note as well, I didn't notice the lack of bold.

In short, its a bug. I don't know if its with Flare, or with Word, but given Word's inability to play nicely with stylesheets I suspect Word.

You know the drill, submit a bug report. :wink:
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
jmenning
Propeller Head
Posts: 50
Joined: Thu Jul 20, 2006 2:52 pm

Re: CSS property for adding text to a style, like "NOTE:"

Post by jmenning »

I know it's an extra step, and a pain, but the Replace feature in Word should be able to replace the {b} tags with formatting.

Find "{b}Note:{/b}"

Replace with "Note:" , and in the Replace options, use Format > Style or Format > Font to bold the text.

Just throwing that out there. It may or may not be worth the effort, depending on how frequently you generate the printed document.
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

the Replace feature in Word should be able to replace the {b} tags with formatting.
Not an option for me. Printed help is part of the deal. One of the main reasons I'm using Flare is because I need my nightly build system to automatically generate the PDF. Thus, there's no point where I can diddle Word, even if I was willing to, which I'm not. I make my edits in Flare, check it into source control, and walk to the bus. In the morning, there's a piping hot PDF waiting for me.

I'm still hoping for a miracle from one of you smarties. It's happened before. Come on, smack one out of the ballpark for me...somebody!

Seriously, thanks all. This single thread has been an educational experience for me.
Matt F
You learn something new every day if you're not careful.
jmenning
Propeller Head
Posts: 50
Joined: Thu Jul 20, 2006 2:52 pm

Re: CSS property for adding text to a style, like "NOTE:"

Post by jmenning »

Yep, you're right. In that situation, it needs to just work...

I hate to suggest it, but the only other thing that's coming to me is to create a snippet with the Note: formatted the way you want. Insert it every time you add a note. Then at least if you needed to change the format, font weight, graphic, etc, you wouldn't have to make the change in a bazillion places. Not as slick as using a stylesheet, but possibly better than all-manual formatting. It basically guarantees a uniform code you can use to Find all instances and make a global change somewhere down the road (for example, if a software fix makes the styles work in Word and you want to convert the notes).

Of course, it lacks any semblance of elegance (Cool factor approaches zero...) :? Not the answer you were looking for, I know...
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

Thanks jmenning,
Not a terrible idea, really. You're right, though. I just want the CSS to work all the way through to the PDF.
Matt F
You learn something new every day if you're not careful.
SteveS
Senior Propellus Maximus
Posts: 2087
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).
Contact:

Re: CSS property for adding text to a style, like "NOTE:"

Post by SteveS »

Of course we can cheat...
note.JPG
... use a table.

Code: Select all

<table class="table_1" style="width: 600px;">
            <col style="width: 65px;" />
            <col />
            <tr>
                <td class="td_1">
                    <p class="p_1" MadCap:autonum="Note 1:"> </p>
                </td>
                <td class="td_2">
                    <p class="p_2">For blog</p>
                </td>
            </tr>
        </table>
Stylesheet:

Code: Select all

td
{
	vertical-align: top;
}

p.p_1
{
	font-weight: bold;
	mc-auto-number-format: 'Note {n+}:';
}

td.td_1
{
	background-color: #92D050;
	border-top-style: dotted;
	border-top-width: 2pt;
	border-top-color: #FF0000;
	border-left-style: dotted;
	border-left-width: 2pt;
	border-left-color: #FF0000;
	border-bottom-style: dotted;
	border-bottom-width: 2pt;
	border-bottom-color: #FF0000;
}

p.p_2
{
	margin-bottom: 0pt;
}

td.td_2
{
	background-color: #92D050;
	border-top-style: dotted;
	border-top-width: 2pt;
	border-top-color: #FF0000;
	border-right-style: dotted;
	border-right-width: 2pt;
	border-right-color: #FF0000;
	border-bottom-style: dotted;
	border-bottom-width: 2pt;
	border-bottom-color: #FF0000;
}

table.table_1
{
	background-color: #92D050;
	border-collapse: collapse;
}
Not elegant, but it works.
You do not have the required permissions to view the files attached to this post.
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: CSS property for adding text to a style, like "NOTE:"

Post by KevinDAmery »

The cool people don't use tables for layout.

'Course, the cool people are the ones with their underwear poking above the waist of their pants.

(Translation: if it works, I don't much care if it's secksy....)
Until next time....
Image
Kevin Amery
Certified MAD for Flare
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

Eureka! Here's a solution that works both for WebHelp AND FOR PRINT! Scott DeLoach teaches a great Flare seminar in CSS, which I highly recommend to all. I climbed the mountain to talk to the swami of stylesheets, and here's what he came up with...
Hi Matt,
That was a good challenge!

Here's an approach that works in Word, IE7/8, FF 3, Opera 7, Safari 2. Didn't test it in IE6, but it should work.

The trick is to create a span class to format the "NOTE." So, first create a span class that includes your formatting. I tested bold and a font color, and both worked.

Next, open your note style. For mc-auto-number-format, type your content. Don't use the formatting options, like {b}. Word won't know what those are. Instead, use the mc-auto-number-class property to specify your class.
The only part that might need further explication is entering the auto-number-class. At first I tried to enter "span.note" in the mc-auto-number-class, since Scott didn't say exactly what to put in there. That didn't work (didn't even "take"). If you've created a span class called "span.note", then all you do is enter "note" in the mc-auto-number-class... and by golly... It Just Works.

Many thanks to Scott for getting me/us through this sticky wicket!
Matt F
You learn something new every day if you're not careful.
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

To make this simpler to reproduce, if any of you care to, I'm pasting the code I used for both the <p> classes and the <span> classes, based on my understanding of Scott's instructions:

Here's the css for the subclasses p.Note:

Code: Select all

p.Note
{
	font-style: normal;
	mc-auto-number-class: note;
	padding-top: 0.5em;
	padding-bottom: 0.5em;
	padding-left: 0.5em;
	mc-auto-number-format: 'NOTE:  ';
	background-color: #d2f0ff;
}
And here's the css for the span classes.

Code: Select all

span.note
{
	font: Arial;
	font-family: sans-serif;
	font-weight: bold;
	font-size: 10pt;
}
I also made similar for TIP:, IMPORTANT:, and WARNING:, and gave each of them a different background color. You can even give each word a different color by adding "color: #ff0000" (for red) in the span class.

Hope this is helpful to some.
Matt F
You learn something new every day if you're not careful.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: CSS property for adding text to a style, like "NOTE:"

Post by NorthEast »

Glad you got it sorted, but did you not see this method mentioned further up the thread? :wink:
mattf
Sr. Propeller Head
Posts: 277
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: CSS property for adding text to a style, like "NOTE:"

Post by mattf »

Jeepers, now I'm pretty embarrassed. Now that I go back and look, I remember seeing that option but that spot in the thread was where my confusion was approaching its peak, and your comment beneath your explanation led me to believe that it would cause all the text in the NOTE: paragraph to be formatted bold, which I didn't want. It appears now maybe that wasn't what you were saying. Anyway, that's the ONE suggestion in the thread I never tried. Oh well. The job's done.
Matt F
You learn something new every day if you're not careful.
DurtyMat
Sr. Propeller Head
Posts: 224
Joined: Wed Aug 22, 2007 8:09 am
Location: ClrH2o, Fl

Re: CSS property for adding text to a style, like "NOTE:"

Post by DurtyMat »

what if you need a hanging indent on the next line of the note? thats why i did the image gimmick....BUT, we really need a solid note/example/dange will robinson/tip for our print/web output ....

this thread is making me feel like a /sadpanda

but here:

Image
Flare: I bought it ... so that means I can break it, right?
dang
Jr. Propeller Head
Posts: 6
Joined: Wed Feb 01, 2006 7:46 am
Location: Boston MA

Re: CSS property for adding text to a style, like "NOTE:"

Post by dang »

Here is a hack for indenting the text portion of the note for online output only. Word output still displays pretty well, sans indented text.

The idea is to apply a negative indent to the autonumber.

Indent p.Note a little more (margin-left: 4em;):

Code: Select all

p.Note1
{
   font-style: normal;
   mc-auto-number-class: note;
   padding-top: 0.5em;
   padding-left: 0em;
   padding-bottom: .5em;
   margin-left: 4em;
   mc-auto-number-format: 'NOTE:  ';
   background-color: #d2f0ff;
}
Apply a negative indent to span.note (margin-left: -3.5em;):

Code: Select all

span.note
{

   font: Arial;
   font-family: sans-serif;
   font-weight: bold;
   color:red;
   margin-left: -3.5em;
   }
Wrap it all in a new div:

Code: Select all

div.Note
{
  background-color: #d2f0ff;
}
It is easiest to save your note (p.Note wrapped in div.Note) as a snippet for re-use rather than manually applying the styles.

Best,
Dan
DurtyMat
Sr. Propeller Head
Posts: 224
Joined: Wed Aug 22, 2007 8:09 am
Location: ClrH2o, Fl

Re: CSS property for adding text to a style, like "NOTE:"

Post by DurtyMat »

thanks dan for the reply, anyone have any ideas how to get the hanging indent to work? the team just got on my back about trying to get these silly note/danger/warning gimmicks to work in word outputs.

thanks in advance.

ps - glad the OP got his to work :P

Image
Flare: I bought it ... so that means I can break it, right?
Post Reply