MS Word 2007 - How to set up placeholder text to mimic text but not formatting - ms-word

I'm probably biting off more than I can chew with this particular problem, but I'll try to be as specific as possible in case it's within my scope. Disclaimer: I'm not terribly experienced with MS Word, beyond simple data entry/some formatting, and I have absolutely zero experience working with macros or VBasic. Unfortunately, I'm afraid the solution to my problem will come in the form of one of those last two.
THE GOAL:
What I want to do is to have placeholder text throughout my template document that will change content but not formatting when the first instance of it is changed. Basically, I'm writing a template for support manuals for a software suite. Each app has certain similar features like the menu bar, data entry screen, diagnostic log screen, transaction history, etc., so I am pre-writing those sections and using placeholders when I need to insert certain app specific properties.
I started off using the Insert->Quick Parts->Document Property->Subject tool which I used as a placeholder for the app name. I set the Property to [Subject] and then used Insert->Quick Parts->Field->Subject throughout the document, wherever I needed to include the app name. This worked fine in this case because the app name will always be capitalized. I simply change the text in the first [Subject] (which is content controlled) and update the fields throughout the document, and they all match nicely, easy-peasy, work done, go home and drink beer, right?
Not quite.
Our software handles part tracking via scanners and SQL Server, so while the interface and menu in the apps remains largely unchanged, the parts they track change from app to app. Because of this, I need to change the part name when I reference it within the text of the manuals; for example, if I'm working in ToiletPap.app and our TP is tracked by the roll, I need every mention of [Component] to be changed to roll. If I'm working in LightBulbs.app, I need [Component] to say bulb.
My first efforts went toward creating a custom doc property called Component using the Advanced tab under the Document Properties dropmenu. I then created a plaintext content control around my first [Component] titled Component and made my next [Component] a field with modified code: {COMPONENT * MERGEFORMAT}. This comes from copying what I can find when [Subject] works. This didn't work at all; updating the text in the first CC doesn't change the Content doc prop, and my fields return "!Undefined Bookmark, COMPONENT".
I got close to what I need by using the [Comments] doc property, set initially to [Component]. I used it just like [Subject], but (this is when I realized that capitalization was going to be an issue) when I mention my [component] in-text, as often as not, I need to to be lowercase instead of upper.
I've looked on MS's forums and a few others as well as here on SO, and I can't find anyone who's trying to do the same thing, much less an answer to how. Please keep in mind when answering, it would be a great help to me if you would include step-by-step instructions on how to enter/implement the code you provide because, as I mentioned, I have no idea how to go about editing macros/VBasic for MS Word.
To restate and summarize my overall question: How can I use a placeholder that displays the text "[Component]" so that, when I change the first instance of [Component] to something else, say "hopper", every subsequent instance of [Component] is updated to hopper but maintains its current capitalization and formatting scheme?
Apologies for the length of the request, but I wanted to make sure I explained the situation as accurately as possible. Thanks in advance for your consideration and responses.

I managed to solve this one after a couple extra hours of tinkering. I didn't need macros or VBasic, either.
On the first instance of [component] I created a plain-text content control to act as a container (not a necessity, but it makes it look nicer. Will likely cause a problem eventually, but for now, it's working as intended) and bookmarked it. Then, for all other instances of [container] I selected each and used Insert->Quick Parts->Field->Ref with the following field code:
REF Text1 \*Lower
Where "Text1" is my bookmark and "*Lower" indicates all lower case. The *Lower can be replaced with *Upper or *FirstCap to indicate all upper case or capitalize the first letter respectively. Now, each field reflects the text of the first with the capitalization appropriate to each field's location within the document. Just like using the doc prop with [Subject], ^a -> f9 is needed to update all fields within the document.

Related

Using a List Box's user-choice as a Condition in LibreOffice Writer

I'm trying to make a form-fillable pdf where List Boxes will affect other parts of the sheet.
I have several Hidden Paragraphs in my document (hiding graphics, etc), and a List Box. I'd like to use the List Box choice as the Condition to dynamically hide and unhide the various Hidden Paragraphs.
Example: The user selects clicks on the List Box, and Cat, Dog, and Bird are listed. If the user selects "Dog" from the list, the paragraph with text and pictures of dogs is no longer hidden.
I get that I have to do Hide Paragraph if [List Box choice] != "Dog" as my Condition, I just can't figure out where to get the List Box choice. Feels like I hit a wall in searching for an answer or guide because I'm missing specific terminology (field? formula?).
I am actually trying to do the same thing, and I'm getting very frustrated by it. I developed a case management database for my law office (actually, it pretty much manages almost every aspect of the office at this point), but because we handle all kinds of different cases (criminal defense, civil litigation, probate, etc.) the information we need to track often varies. For instance, on criminal cases, we need to keep track of the sentencing guidelines scoring, the current offer from the prosecutor, prior convictions, and so on. For family law cases, we need to keep track of things like assets, parenting time schedules, etc. Putting all of these variable on one page at the same time gets very cumbersome very quickly, so I'm trying to set the form up so that when you select a case a "criminal defense", it shows the "Criminal Defense" portion of the page, and hides the "Family Law", "Civil Litigation", "Probate", and other portions.
The only way I could come up to do it was the create a variable (in this case, I called it "CaseType") and set the paragraphs to hide or be visible depending on what the variable is set to. This works great, except (a) it's awkward making users select the type of case it is for database purposes, and then making them select the type of case details to display in the form; and (more importantly) (b) the user has to type the required value of the variable into the dialog directly, which is a pain. I would much rather be able to have the type of sections that are displayed determined by the value of the case type in the database, or at the very list have the panels displayed in a dropdown list.
I came up with an idea to record a macro that would run when you pushed buttons--for example, press the "Criminal Case Panel" button and a script would run that selected the variable via double-click, entered the correct value in the dialog box, and then applied the new variable, but it seems that Writer will not let you record macros that change values in dialog boxes.
There is so much untapped potential in this aspect of the software; if the user variables could be set by forms--or if the "hidden" flags could be triggered to be hidden by the values of database variables--it would open up so many possibilities. Makes me wish I had the coding skills to work on this part of the software.
According to https://help.libreoffice.org/7.0/en-US/text/swriter/01/04090200.html, you can set up a database for Writer conditions. It looks like this would work with LibreOffice Base, where forms with list boxes can be created.
However, if you are trying to use values from a list box in a standalone Writer template or other document, then looking at that link, it does not seem possible. Writer conditions are restricted to document metadata, not the contents of the document.
One solution is to write a macro that pops up a dialog with a list box, and then when the dialog is closed, modify the Writer document based on the selected values. LibreOffice has a dialog development front end to help you set this up, and then you would need to write code to execute the dialog and do the changes. See https://www.pitonyak.org/oo.php for help writing the necessary code.

manipulating Microsoft Word DOCX files that have links and track changes using Python

I have been using the excellent python-docx package to read, modify, and write Microsoft Word files. The package supports extracting the text from each paragraph. It also allows accessing a paragraph a "run" at a time, where the run is a set of characters that have the same font information. Unfortunately, when you access a paragraph by runs, you lose the links, because the package does not support links. The package also does not support accessing change tracking information.
My problem is that I need to access change tracking information. Or, more specifically, I need to copy paragraphs that have change tracking indicated from one document to another.
I've tried doing this at the XML level. For example, this code snippet appends the contents of file1.docx to file2.docx:
from docx import Document
doc1 = Document("file1.docx")
doc2 = Document("file2.docx")
doc2.element.body.append(doc1.element.body)
doc2.save("file2-appended.docx")
When I try to open the file on my Mac for complicated files, I get this error:
But if I click OK, the contents are there. The manipulation also works without problem for very simple files.
What am I missing?
The .element attribute is really an "internal" interface and should be named ._element. In most other places I have named it that. What you're getting there is the root element of the document part. You can see what it is by calling:
print(doc2.element.xml)
That element has one and only one w:body element below it, which is what you get when with doc2.element.body (.xml will work on that too, btw, if you want to inspect that element).
What your code is doing is appending one body element at the end of another w:body element and thereby forming invalid XML. The WordprocessingML vocabulary is quite strict about what element can follow another and how many and so forth. The only surprise for me is that it actually sometimes works for you, I take it :)
If you want to manipulate the XML directly, which is what the ._element attribute is there for, you need to do it carefully, in view of the (complex) WordprocessingML XML Schema.
Unlike when you stick to the published API, there's no safety net once ._element (or .element) appears in your code.
Inside the body XML can be relationships to external document parts, like images and hyperlinks. These will only be valid within the document in which they appear. This might explain why some files can be repaired.

Setting the controlsource value of a listbox using Properties Window

I am new to VBA and am currently still studying the most basic ideas of the language. I haven't gotten that far in my VBA Code studies to write the code I need by hand, so, in the mean time, I have been using the VBA Editor to enter Property Values via the Properties Window. This has been proving far more difficult than I anticipated. My Goal is to create a drop down list for a VBA Form. I understand one of my options is to reference a range of cells in my excel worksheet by inputting it into the value field located right of the ControlSource Property. My attempts to input the desired range always comes up with the same error:
Could not set the ControlSource Property. Invalid Property Value.
I have tried looking in the VBA Help files and even searched online. I haven't had any luck finding the proper syntax to enter into this field.
I am assuming I may run into similar issues as I try to set other property values through the Property Window. Thus, I am diligently studying my VBA courses so I can simply write the raw code. But that takes time and I need this form to work as soon as possible.
Is there anyone out there that wouldn't mind lending me their brain for a moment? I would be most grateful. Having this working would bring a lot of stress off of me.
Thanks for reading!
What tigeravatar mentioned, works fine for me, for the ComboBox as well for the ListBox.
If I enter =a1:b5 into the ComboBox' RowSource, I see the values of the cells if I open the form and the Combobox. Tigeravatar's notation with $ and sheet! may be more reliable for the productive version.
The RowSource is where the boxes get their displayed items from. The ControlSource is where the chosen value finally is linked to. So if I write just A10 to the ControlSource, then open the form, then pick a value, close the form, I see the chosen value filled to the Excelsheet field A10.
Sometimes it helps to start a fresh UserForm and to add some simple fresh controls. If you seek around, you will probably alter property values that influence the behaviour in an unexpected way, and then you get lost. I have tested with Office 2010. If you have another version, it may be important to forum readers to know.

How does one get the total number of slides?

In Articulate's Storyline product, how does one retrieve the total number of slides (or pages) in a storyfile or project?
There's not much documentation so it's kind of hard to figure out how to query common environment values like this. If we can get the total number of slides then we don't have to manually set a value for it.
One must manually set and update a variable to store the number of slides.
The most lengthy conversation on the matter seems to be found here at the Articulate forums.
In that thread the users and staff describe the need to manually define such a variable.
I asked the question on the official forum more directly here, and so far have not received a response.
Another poster at that forum mentioned using PHP to solve this problem, but unfortunately we can't add the requirement of PHP to the final product. I'm sure some server side language tricks might be used to solve this issue, but that also adds the dependency of a particular server-side language.
The Answer Mark gave is correct. So if you want to track the number of question slides in a quiz you would either hard code the value in a variable such as totalQuestions, or increment it as you go through each slide using adjust variable trigger. To call that value and display it on screen you would just add it to a text field and surround it with "%".
EG. "You have answered %Results.ScorePoints% out of %totalQuestions% questions correctly."
I find it rather pointless to hard code it since it's just as easy to put the value in the text field at the end. Using the increment method seems more logical because then you can add more question slides without having to adjust the variable or results screen each time.
I usually load frame.xml, browse for all slidelink tags and sort all slides by their Id.
Usually you get something like slideid=_player.5xoxGTW6QCh.6bmeRt3tCqP, where 5xoxGTW6QCh is the scene id and 6bmeRt3tCqP is the slide id. displaytext also gives you the slide title.
If you browse for slidetranscript and match the Id for each transcript you also get the slide notes.
Articulate 360 now has an internal (Built-in) variable for this and other counts. See Project.TotalSlides and Menu.TotalSlides
See https://community.articulate.com/series/articulate-storyline-360/articles/storyline-360-add-slide-numbers

Trying to replace content zones in typo3

What I'm aiming to do!
I'm creating a template for a site in typo3, and i'd like to get rid of typo3's default content zones, and replace them with my own.
I.E. On the page menu.
to remove left, content, border
and to keep/add. Header. Main. Right.
The problem!
I've found snippets around the web, and bluntly, what I'm expecting to happen, isn't happening. Where every post seems to be "Thank you, great success! ++", the code I paste isn't throwing any errors, and isn't doing anything, well, at all.
My attempt
Via the typo3 documentation http://typo3.org/documentation/snippets/sd/24/
I call mod.SHARED.colPos_list in order to choose the three sections to display
t3lib_extMgm::addPageTSConfig('
mod.SHARED.colPos_list = 0,1,3
');
And I edit the TCA in extTables.php to set them to my specs.
$TCA["tt_content"]["columns"]["colPos"]["config"]["items"] = array (
"1" => array ("Header||Header||||||||","1"),
"0" => array ("Main||Main||||||||","0"),
"3" => array ("Right||Right||||||||","3"),
);
extTables.php is being called as as a die(); cuts the page.
I've cleared the cache and deleted typo3temp, logged out and in again.
But nothing happens.
My main guess, is, is this feature anything to do with templavoila? I removed it as I felt like trying out the new(er) typo3 fluid templating system, and didn't feel that I needed a GUI editor.
Any ideas?
Well - the more pages and content elements you got the more problems you will have to face when using TemplaVoila. Having comma separated values in XML structures saved to a single database field will be a performance killer as soon as you want to collect content from more than one page (uncached teaser menus or the like). Handling of references and "unused elements" is questionable as well. Of course it will work for small to medium sites, but concept wise a clean approach looks different.
Backend layouts are available since TYPO3 4.5 and work flawlessly since they just represent a normalized relation between elements and pages based on colPos. If you need more, Grid Elements will take this principle to the next level, offering even nested structures but still based on normalized relations, which will make your life much easier when it comes to DB cleaning and other maintenance tasks.
Find an introduction to backend layouts here: http://www.youtube.com/watch?v=SsxfNd4TYbk
Instead of removing default columns you can just rename them...
TIP: Use TemplaVoila extension for templating, you'll find much more flexibility there.