Grep Styles cannot replace text.
It can only apply a Style, like bold or Italic to the text.
You'd be better off importing the text to Excel first - having it apply a Percent and decimal placement in the cell there.
Then import the excel sheet into InDesign.
I'm afraid what you're asking to do with Grep Styles is just not possible as it's not designed for that.
However it might be possible to Script what you want.
Thanks for the quick response! As I understand it, the problem with applying formatting in excel is that there the numbers simply APPEAR to be smaller. When you export them to XML, the formatting doesn't come with. Is there a smart way to get around this problem? Surley tons of people must use an automated proess to layout pages of numbers in InDesign.
Surley tons of people must use an automated proess to layout pages of numbers in InDesign.
True or not, InDesign by itself is not capable of applying or performing mathematical operations on the contents of text frames.
So, the next step, (for us here on the forum), might be to examine the reasons you're using XML rather than placing "static" content in InDesign. Are your fact sheets to be dynamic going forward?
When I created the Excel test file I imported the Excel file to InDesign and the number came in as -7.0%
I don't know about maybe using the XML Map feature in Excel?
I don't know enough about what you're doing to really help.
Sure - thanks for your help. Maybe there's a better way to do this overall that I'm not aware of. So I have a database in essentially this format: (only much, much bigger--a couple hundred rows and 163 columns)
Geography Total_Population_2000 Total_Population_2010 Total_Population_CHANGE 1 56,791 52,798 -7.0% 2 53,465 64,637 20.9% 3 51,322 36,914 -28.1% 4 51,304 41,647 -18.8%
I was thinking it could work to use XML to merge everything so that I have a template with all the indicators, and then the first page is all geography 1, second page all geography 2 and so on. The last time I did this, I used SAP Crystal Reports which was super cludgy and made an ugly product it took me hours to clean up in InDesign. Would it be better to try to accomplish this with a data merge? Can you get number formats in that way? I really only have experience using InDesign to layout books, reports, invitations etc. This is the first time I'm using it as part of a more robust process, so please forgive my awkward questions.
Re: dynamic content, I was vaguely thinking that if I could get this right, it might be easier to beg someone to help me make a little tool to make the info easily searchable on our website. It's certainly not essential, though, and may be me reaching too far past my skills. I just want to figure out the best way to make a spreadsheet become a bunch of fact sheets that look neat and nice.
A data merge should be better.
And it should import the numbers as you describe.
Only way to know is to try.