Categories > OpenTBS with DOCX >

Feature idea

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: David
Date: 2013-01-14
Time: 02:28

Feature idea

I often find myself doing something like this:
The enclosed material is sensitive to [onshow.company.company_name] [dta;block=begin;when [var.shortened_name]=1] (Hereinafter [onshow.company.company_name_short]) [dta;block=end]and related entities and discloses critical information concerning
its financial position, customers, vendors, creditors, and employees.
It would be really cool if I could do something like this instead, eliminating the need for a block:
The enclosed material is sensitive to [onshow.company.company_name] (Hereinafter [onshow.company.company_name_short;omagnet='(';cmagnet=')']) and related entities and discloses critical information concerning
its financial position, customers, vendors, creditors, and employees.
where omagnet is text (not a word tag) that opens a section and cmagnet is text that closes the section.
By: Sarah
Date: 2013-01-14
Time: 17:17

Re: Feature idea

I don't know if this helps, but you can always used multiple <w:t>s like this:

<w:t>The enclosed material is sensitive to [onshow.company.company_name]</w:t><w:t> (Hereinafter [onshow.company.company_name_short;magnet=w:t])</w:t><w:t>and related entities and discloses critical information concerning
its financial position, customers, vendors, creditors, and employees.</w:t>

If you look in the source of a Word document, sentences are often broken up in this way to accommodate spelling/grammar error styling.
By: David
Date: 2013-01-14
Time: 19:01

Re: Feature idea

Sorry, but my knowledge of word is not good enough to figure this out. I don't understand how to get the <w:t> and </w:t> around the parentheses. I thought the w:t tag was the start of the document text and the /w:t was at the end. How do I get word to insert the tags?

Thanks,
David
By: Sarah
Date: 2013-01-14
Time: 19:31

Re: Feature idea

Ah, I should have realized you were working in WYSIWYG. I don't know of a way to make Word include extra <w:t>s where you want them inside Word, the method I was talking about only works if you are editing document.xml directly.
You might want to look at the findBounds() function here: http://www.tinybutstrong.com/manual.php#coding_block_alias

It looks like this will allow you to search for the nearest '(' as a method of encapsulating your block. Of course, this uses a block, which I know you wanted to avoid. Unfortunately I haven't worked with this so I can't tell you much more about it.

I will point out that you may not need to stress about how Word is placing these tags. When I ran a basic test with a document containing only the content you provided, I used:

The enclosed material is sensitive to [onshow.company.company_name] (Hereinafter [onshow.company.company_name_short;magnet=w:t]) and related entities and discloses critical information concerning
its financial position, customers, vendors, creditors, and employees.

And it behaved correctly, because Word was already separating your string into multiple <w:t>s and TBS does its own cleanup. So that might be worth a try.

Good luck.
By: David
Date: 2013-01-14
Time: 19:40

Re: Feature idea

Thanks. I will try to use the w:t on a few of these and see what I get. Do you know of inexpensive software that would provide an easy way to edit the XML directly on a Mac if I want to insert the tags manually?
By: Sarah
Date: 2013-01-14
Time: 20:43

Re: Feature idea

Any text editor will do it - there are lots of options. I use (Windows) Notepad++ with an XML Tools Plugin to format it so it is easy to read. I am sure there is a program that comes with your computer that is capable of it,
and from what I found on Google, Macs come pre-installed with xmllint, which is what does the formatting. If that doesn't work for you, I know there are many free options available - it is really a matter of preference. A
quick google search for 'mac xml edit format' turned up plenty of free results.

It looks like you can use Text Edit, which comes with the OS (?) - though you may need to check preferences if the tags don't display right off the bat.

Keep in mind that if you decide to edit the xml directly, saving the file again in Word will likely undo your work on the xml (at least some of it - it depends what you change).