sternopygus Posted April 21, 2009 Posted April 21, 2009 Is it possible to export font styles from FileMaker pro into Excel or XML? I can't seem to find anything in the help document about this. Preferably, it would be nice to have the data in XML with tags around the text that has font styles applied. Any ideas! thanks
comment Posted April 21, 2009 Posted April 21, 2009 If the data itself is styled text, you could export the contents of a calculation field = GetAsCSS ( field ) instead of the field.
sternopygus Posted April 21, 2009 Author Posted April 21, 2009 That's a great idea! How did I miss that tag? The XML output is messy, but it's workable.. thanks
comment Posted April 21, 2009 Posted April 21, 2009 The XML output is entirely customizable through the use of a XSLT stylesheet.
sternopygus Posted April 21, 2009 Author Posted April 21, 2009 That sounds like something I should be doing, but I'm not very handy with XSL. Here's an example of one node from the output I get from XML w/o using XSL: ///////////////////////////////// ANIMAL FLIGHT Birds and bats are the only true flying vertebrates. flight_1; flight_2 ///////////////////////////////// What would an XSL document look like to modify this? Ultimately this xml is going to be imported into FLASH, which I am very familiar. So, I was going to just create a css stylesheet that also loads into flash and applies the formatting.
Fenton Posted April 21, 2009 Posted April 21, 2009 It seems to me to be pretty darn hard to somehow transfer arbitrarily added font styles from FileMaker to another environment controlled by a CSS file. It's similar to the problem of visual web page apps. By the time you've messed around and got all your formatting done, the code is pretty much a nightmare, compared to how you'd do it manually. How about this idea, which seems to me a lot simpler. If you know how you want it to look, then all you really need is to include: class="class name", or, id="Id" with the data. In other words output what you'd put if you did it manually, so that elements matched up with your external CSS file. You could still use Export XML, but output the finished code you'd need, either HTML or XML for Flash. You would certainly need an XSL stylesheet, and that is where you add the Attributes of the CSS class/ids.
sternopygus Posted April 21, 2009 Author Posted April 21, 2009 Well, your idea sounds a lot easier, however, I'm not great with XSL. I was hoping there would be some XSL templates developed by FileMaker to convert it's own css tags, but I haven't found any yet. It might be easier for me to write a calculation that formats the results of getAsCSS(text) the way I want it to look before I export as XML. For example, if FileMaker gives me this when I use getAsCSS(text) Birds and bats I'll use substitutions to produce this: Birds and bats Well I'll see how that works..
comment Posted April 21, 2009 Posted April 21, 2009 The text styles used by Filemaker are pretty standard, and so is the CSS, so I don't think it needs to be too difficult to transform it to another standard that uses the same standard text styles (provided you have some XSL skills). However, there is another issue I'd like to point to: Filemaker only adds CSS to a field when the DATA has been styled by the user. IOW, the same field can have styled contents in some records, and plain text in others. From your example it seems you want a certain style to be ALWAYS applied to some fields. If so, you don't need Filemaker's CSS - you can export the field data directly, and format it any way you like in the stylesheet.
Fenton Posted April 21, 2009 Posted April 21, 2009 Yes, the 2nd point is more or less what I was getting at; that if you know how you want it to look, then you don't need to mess around with GetAsCSS. I am not a web designer per se, but even I know that inline CSS should only be used in special cases, when your CSS stylesheet rules need some inline modification. There are many ways to do web formatting, but an external CSS stylesheet is the best. Then all you need to get into your exported file is the class attributes. You can do that with an XSL stylesheet, without having to "muck up" your FileMaker file or data. You can end up with either an HTML file or an XML file (since you mentioned Flash). I don't really know which.
comment Posted April 21, 2009 Posted April 21, 2009 I have taken another look at the example and it appears my assumption was wrong, because there is a field that contains a mixture of styles: Birds and bats are the only true flying vertebrates. The distinction between the two parts of the field cannot be preserved during export, unless it's exported with the associated CSS.
Fenton Posted April 21, 2009 Posted April 21, 2009 Yes, that's true. That would certainly be one of the "inline" exceptions. A way to get around this would be to separate the data. That is, "Birds and bats" in one field, and the rest in a Description field. It would not be so "text-like," but likely easier to deal with later. In other words, make your web page more "database-like".
comment Posted April 21, 2009 Posted April 21, 2009 That would certainly be the best way to approach it - if possible given the nature of the data.
sternopygus Posted April 22, 2009 Author Posted April 22, 2009 Thanks for all the great ideas.. However, I can't program XSL, so I still have the awful task of figuring out how to get my formatted data out of FileMaker Pro as XML. *** Wouldn't it be nice if FMP had additional XML export options to handle these situations*** The only font styles I'm using to format my FMP text is 'bold, italic, underline' I'm not worried about font size, color, etc... So all I want to do is export the data in each record as XML like this: Birds and bats are very cool animals Would anyone happen to have an XSL document that can do this? thanks in advanced..
comment Posted April 22, 2009 Posted April 22, 2009 This is not as simple as it may seem. Getting formatted data out of Filemaker as XML is quite easy. However, it is NOT really XML, since it comes out of a field. Filemaker's XSLT processor sees the entire field's contents as a single string - so you cannot tell the stylesheet "do this for each element" (or at least I haven't found a way to do so). To convert the CSS styling to another type would require a second transformation before (or during) importing the data (perhaps by running an Applescript immediately after the export?). If that's not possible, then I believe it needs to be calculated while the data is still inside Filemaker.
sternopygus Posted April 24, 2009 Author Posted April 24, 2009 I didn't want to leave this post hanging without some type of solution, so here's what I finally came up with.. I found this custom function developed by Tom Robinson called BoldItalicEncode(Text). Visit this url to see how it works: http://www.briandunning.com/cf/709 In a nutshell, this function wraps my formatted text with {} for BOLD and [] for ITALIC. For example, in FMP if the text HELLO WORLD was formatted bold and italic, the custom function would return {[HELLO WORLD]} Then, after I use the function to convert my formatted text, I export as XML. Then I import the XML data into FLASH and convert the {[HELLO WORLD]} tags to HELLO WORLD, which gets formatted as HTML (HELLO WORLD) in the flash player. that's it..
comment Posted April 24, 2009 Posted April 24, 2009 Well, this thread is about exporting, so I didn't want to get into the details of the calculation. However, something puzzles me: if Flash can understand HTML, why can't it read in-line CSS style tags? BTW, I thought of a possible export solution, but for now I am only going to outline it: 1. Export the CSS-styled text, using stylesheet #1 to a temp location (once the file is saved, the CSS becomes valid XML). 2. Do a second export, using stylesheet #2. The second export (or its stylesheet) includes a reference to the temp file, so the contents can be used and converted.
Recommended Posts
This topic is 5692 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 accountSign in
Already have an account? Sign in here.
Sign In Now