Jump to content
Server Maintenance This Week. ×

change text background color of part of the field


This topic is 3767 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello, I'm new to this forum and to filemaker also. I have a problem that I'm unable to solve so far, and would really appreciate all help.

 

I have a lot of text in my database, and I'd like to highlight some part of it. I know TextStyleAdd would be a possibility, but I need to highlight in different colors (what TextStyleAdd would not, to my knowledge, allow). This is so easy to do on a program like MS Word, just highlight one part of the text in blue, another in red, etc. I already know how to change the color of the text, and make it bold, italic, but what I want is to change the background color. Is it possible in FMP? Not the whole field, just the part I want.

 

If impossible in fmp, what's the best way to work around it? The db main use is printed, hence the idea of highlighting being so important. Im thinking about using html to print, as I could "highlight with code", but it seems to be a little weird. Are there any better solution?

Link to comment
Share on other sites

Not directly related to your question, but what exactly is the significance of such highlighting? If it's required in order to properly describe the object being recorded - IOW, if it is data - then text formatting (of any kind) is not a good place to keep this information.

Link to comment
Share on other sites

no, the highlight is not intended to describe the object (at least not in its strict sense). I'm building a database of my school reading material, and, as such, I highlight it in various colors. My idea was to print it as I would have, then, a notebook that contains, at the same time, the full content (like, if I missed one thing, I could easily look to the non-highlight part) and the shorter version (as I would jump from highlight to highlight).

 

In a broad sense, the highlight indicate a part of the reading that I found more relevant than the rest (and, as such, I could put it in a noteworthy section), but I don't know how this help me in the reading after. Maybe I'm missing something important, but considering that I have to re-read my notebook dozens of times, I prefer it in paper, and having it highlight is really helpful (I used uPad, the iPad app, previously, for highlighting as pdf, but pdf is not working, as I need a database solution - ability to edit data, transform, sort, etc)

 

thanks for the help so far :)

Link to comment
Share on other sites

I am afraid you haven't made it much clearer. Perhaps an example would be useful.

 

In general, if you have say a record of an article that contains 100 paragraphs and you wanted to highlight 20 of those paragraphs, then ideally the full text of the article would be stored as 100 individual records in a related Paragraphs table. Highlighting a paragraph would then be a matter of toggling a Highlight field in the Paragraphs table - or more correctly, selecting a category (with an associated highlight color) for the paragraph. This is also the only way (I think) that you can facilitate highlighted printing from within Filemaker.

 

Note that in my example, the highlighting is definitely a part of the article's description as tracked by the solution.

Link to comment
Share on other sites

I'm sorry, I'll try to make myself clear. But I didn't understand what you mean by "the highlight is" 1) "part of the article's description" or 2) "tracked by solution."

 

Just trying to explain myself better with a example:

 

I'll read an article about FileMaker, the article from wikipedia about it (http://en.wikipedia.org/wiki/FileMaker). At first, I'd put it in my articles-to-read list (create a record in my Article's Table, which has the fields ArticleID_pk, FullText, Author, Date, etc).

 

When I find the time to read, I'd highlight the important words of the article. Using the first paragraph of the wikipedia's article: (The highlight will be represent by color changing)

 

FileMaker Pro is a cross-platform relational database application from FileMaker Inc., formerly Claris, a subsidiary of Apple Inc. It integrates a database engine with a GUI-based interface, allowing users to modify the database by dragging new elements into layouts, screens, or forms. Current versions are: FileMaker Pro 13, FileMaker Pro Advanced 13, FileMaker Server 13, and FileMaker Go 13 for iPhone and iPad.

 

This would be a example of a paragraph with highlighted portions. And there would be dozens of paragraphs in an article, and hundreds of articles in my database.

 

 

 

Maybe showing what I already have is useful too:

 

I have some scripts that help me in my highlighting. For now, I select a portion of the text with the mouse and press command+1 for activating the script that takes the content of actual field, divide it in three (before, selection and after) modifies the selection and regroup them all, and sets field to it (works pretty well, and with any field). With the fact that I'm the developer and only user, I let with the modified text (for the time being it modifies the color, just for visual help) a pair of tags, like [[lb]] and [[/lb]], for texts that will have, now, light blue color, but that, if possible, would in the future be modified to show a light blue highlight.

 

My question about html (if impossible in fmp, which would really be the best) is due to the fact that, having already tagged the content, and being it so easy, as I would print all my articles (yes, all of them) not that often (like, 6-8 times a year), I could do a script to make a full text (hundreds of pages), and print in some place that allows me to have my background color (like, changing my tags to proper html tags with scripting.

 

thanks very much for the attention, patience and help so far.

Link to comment
Share on other sites

What you could do is highlight your text using text color, then export a calculation field =

GetAsCSS ( Textfield )

Then the real work begins, because you need to replace the Filemaker-generated SPAN styles with your own and get it all to a printable document in some form or another.  All of that is outside the realm of Filemaker. If I had to do this, I would export the data as XML, using a XSLT stylesheet to escape the CSS markup. Unfortunately, that is the maximum that can be achieved during the export, but at least the result is a properly marked-up XML document that can be further processed by another XSLT stylesheet. So the path to say HTML2PDF or XSL-FO is open.

  • Like 1
Link to comment
Share on other sites

Well, I'm not a super-user, but I think I understand what you mean.

 

But, if I'm going outside of Filemaker and, as I said, I'm the developer and only user, wouldn't it be a lot easier if I just scripted my way out? I mean, if I made custom tags in filemaker (like [[lb]] and [[/lb]]), and then I just made a conversion tool, to change the [[lb]] to whatever it needs to be in XML/HTML etc?

 

Also, I know almost nothing of XML, and just a little about HTML. Do you think XML would be easier for the re-tagging and printing? I think I could do all the script in fmp (create one table with one global field just for that, which would receive all the content I want to print, all tagged as XML/HTML needs), and then put it some place to print.

 

I know I've probably gone a little far from fmp, but what would be the best way to print them? Html2PDF is you recommendation?

 

Thanks for all the help so far :)

Link to comment
Share on other sites

The reason I lean towards XML/XSLT is that all tools are already there. After all, you are talking about markup, and XML is the eXtensible Markup Language. Same for "re-tagging" and other processing, since XSLT is the language for transforming XML. True, these tools do have some learning curve. Still, IMHO it's more worthwhile to learn the already existing wheel than to invent a new one.

I also think that using a visible markup, such as text color, would be more convenient than embedded code such as [[lb]] - which not only litters the text, but is also more error-prone.

As for the actual printing - it's quite possible that once you have put a basic HTML document together, you could print it directly from a browser (with only a minimal CSS to force page breaks between articles and such).
 

  • Like 1
Link to comment
Share on other sites

Dear comment,

 

I appreciate all the help, but I still have one question more: what is this in this file? Why isn't that exactly what I'm looking for!!?? Amazing, but, serious, I need a little info about what this is! Totally Amazing!! :) - Be right back with a lot of questions.

By the way, about embedding code, I already thought about doing it error prone (although not that easy). Once I selected some text, I changed it's color and added the keys before and after, all with script. It worked fine.

Link to comment
Share on other sites

Once I selected some text, I changed it's color and added the keys before and after, all with script. It worked fine.

 

IMHO, if you markup with text color then adding the "keys" is redundant. You really should take a look at what GetAsCSS() and GetAsSVG() results look like.

Link to comment
Share on other sites

This topic is 3767 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.