Programming a Indesign table - aid5:cellstyle (ID CS5) - adobe-indesign

i have a Indesign CS5 document.
In the middle is a table, which is filled by my java code, than it's pushed to our Indesign.
My code looks like this:
StringBuffer table = new StringBuffer();
int tableSize = 10;
table.append("<Tabelle xmlns:aid5='http://ns.adobe.com/AdobeInDesign/5.0/' xmlns:aid='http://ns.adobe.com/AdobeInDesign/4.0/' aid:table='table' aid:trows='" + tableSize +"' aid:tcols='5' aid5:tablestyle='anhang'>");
.....
table.append("<Zelle aid:table='cell' aid:crows='1' aid:ccols='1' aid5:cellstyle='tb-right' aid:ccolwidth='65.0'>" + count + "</Zelle>");
table.append("</Tabelle>");
Eveything is working, everything looks like it should, but: aid5:cellstyle='tb-right' is not formating the cell flush right.
Where do i define the style for tb-right? And how it has to look like?

The aid5:cellstyle attribute refers to an InDesign cell style. Cell styles are an InDesign feature - the cell style has to be defined inside the InDesign document the you will import this XML to.
Additionally, to get the text right justified, you'll have to define a paragraph style which does that, and then refer to that paragraph style in your cell style.
All of this can be done manually in InDesign. If you want to programatically define paragraph and cell styles, there are a number of ways to do that, the easiest being through JavaScript. Here's the official Adobe scripting guide for CS5.

Related

NSButton wrap title dynamically

What I want to accomplish:
I need a checkbox with a title text that dynamically wraps and breaks on multiple lines depending on a dynamic width established by the parent view. I need a solution that I can use in IB and that will display there as it's shown at runtime. I'm using XCode 13.1, working in a XIB-File targetting MacOS.
What I'm doing:
I create an NSButton in IB. In the attributes inspector I set its style to Check, under "Control" I choose Word Wrap for "Line Break" and finally I set a very long text as the title such as Asd Asd Asd lit tle words and many of them asd asd lit tle ones.
What's happening:
When setting up the button as described above (case 1) and shrinking its width, it will be displayed - in IB and at runtime - like this:
When manually adding a line break to the title as suggested in this similar question by pressing Option + Enter (case 2, here after "them") the title starts wrapping correctly and all the other necessary breaks are generated:
However this solution is not applicable for my case since it only works for a static width, but my checkboxes need to adjust their width dynamically as described above.
Without that additional manual line break it's most interesting that apparently the checkbox is already reacting and changing its position according to the new wrapped height of the title while the title text itself is just clipped by the bounds of the control instead of being displayed in a wrapped fashion.
What I'd expect:
I'd expect the title to wrap in case 1. Since it doesn't: Is this a bug or a feature? How can I make case 1 work and get the title to wrap dynamically depending on its length and the width of the button? Do I just need to set another attribute in the inspector I missed so far? Or is there only a programmatic solution?
To answer the question why I don't use an appropriately short label: Don't ask me, I'm just a developer following specs & reqs and unfortunately I don't have a saying on what would be a good length of text here.
The credits for this answer goes to #Willeke's comment: "AppKit doesn't support multiline checkboxes." The interesting behaviour of the checkbox in case 1 suggesting otherwise seems to be just a glitch or bug.
What I ended up with: I opted for a workaround. I'm placing a checkbox-button (with Image Position "Image only" in IB) right beside a multiline-label, putting both in a custom view, adding the necessary constraints. With a few positioning adjustments I know have a solution that looks exactly like a singleline checkbox, that I can copy-paste in IB and that is solved by Autolayout - in IB and at runtime - without any additional code.

How to make items in a FMX TListBox bold?

How can I make the items in my FMX TListBox bold? I can't find anything by myself, either in the documentation or the Internet.
You need to set two properties for the tListItem in question. The first line of code below lets you set the font properties for that ListItem rather than having the style dictate the font properties (if you miss this step, the next step will have no affect). The second line sets that ListItem to bold (where, of course, x is the index within the list that should be made bold)
ListBox1.ListItems[x].StyledSettings:=[];
ListBox1.ListItems[x].Font.Style:=[TFontStyle.fsBold];
Thanks to Gregg who gave a working answer for delphi, i'll put a C++Builder version here.
I made a loop over my ListBox with the item count, and it does not affect the loading speed of the ListBox (around 4000 items in my case) so it's a good solution at least for me.
ListBox->ListItems[x]->StyledSettings = ListBox->ListItems[x]->StyledSettings >> TStyledSetting::Style;
ListBox->ListItems[x]->Font->Style = ListBox->ListItems[x]->Font->Style << fsBold;
You can use custom theme for TListBoxItems. Create one by right mouse on ListBox.

Removing the image placeholder (picture) in Word using OpenXML

I have a Word file that I'm manipulating with OpenXML. I have nothing but a picture content control there and I have successfully added a picture ("content") into that picture content control.
Now everything is otherwise fine, but I don't have a slightest clue of how to remove the placeholder picture. That is, I have that "little icon with monitor, sun and mountain" there right in the middle of my inserted picture. You know, the icon that you see when you insert a picture content control. I can take the count of content controls thru VBA and it says there's exactly one, so there's not two controls on top of each other.
If I delete the target content control (with remove-method), the entire content control (including the correctly set picture) gets deleted.
Is there something like "placeholderimage.Hide"-method or something that I should use?
I set the content to the picture like this:
DocumentFormat.OpenXml.Drawing.Blip blip = targetpicturecontrol.Descendants<DocumentFormat.OpenXml.Drawing.Blip>().FirstOrDefault();
blip.Embed = mainPart.GetIdOfPart(imagePart);
This code hides (or removes, whatever) the place holder
private static void RemovePlaceHolder(SdtProperties targetproperties)
{
Appearance appearance = new Appearance();
appearance.Val = new EnumValue<SdtAppearance>();
SdtAppearance sdtAppearance = new SdtAppearance();
sdtAppearance = SdtAppearance.Hidden;
appearance.Val.Value = sdtAppearance;
targetproperties.AppendChild(appearance);
}

adding a default note to powerpoint

I want to modify powerpoint so that the notes section always contains a static text. specifically I want to add
<tags></tags>
to the notes section of every slide created. I was hoping for an easy way to to do this on the master slide, but so far Dr. Google hasn't shown me how. I tried just adding it to the Notes Master but that didn't work.
I'm open to programmatic solutions, but would rather have a settings based solution if it exists.
How do I add text to every slide's note section upon slide creation?
"notes section" could mean different things. If you want some text to appear on every notes PAGE, where it'll appear on all printed notes, you just need to add it to the notes master.
If you want it to appear in the notes text that's part of every notes page (and also appears in the notes pane beneath the slide in Normal view), I don't think it's possible, at least not w/o having an installed add-in.
I have researched this a lot as well, but there doesn't seem to be any way of adding predefined text to the Notes area under the slide in the Slide Master.
You can do it with a macro after the presentation is created. Instead of using "[tag]" & "[/tag]", you can use something easier to type like "/1" and "\1", then use the macro to find and replace your "numbered" tags with the text equivalents.
Something like this:
Dim aSlide as Slide
Dim noteShp as Shape
For each aSlide in ActivePresentation.Slides
For Each noteShp In aSlide.NotesPage.Shapes
If noteShp.PlaceholderFormat.Type = ppPlaceholderBody Then
If noteShp.HasTextFrame Then
If noteShp.TextFrame.HasText Then
noteShp.TextFrame.TextRange.Text = Replace(noteShp.TextFrame.TextRange.Text, "/1", "<tag>")
noteShp.TextFrame.TextRange.Text = Replace(noteShp.TextFrame.TextRange.Text, "\1", "<\tag>")
End if
End If
End If
End If
Next
Next
I am doing exactly the same thing as you are.
I use html style tags in the notes section (the area underneath the slide in Normal View) to organize information and automatically create supporting documentation for the presentation.
Right now, I am doing it by manually by pasting the tags into the Note area under each slide, but if anyone knows how to pre-populate the Note area each time a new slide is added (by modifying the Slide Master settings - not the Notes Master), that would be fantastic.
Looking forward to see if anyone has a solution to this!

Reorder widgets in Qt

I would like to have suggestions as to how to use Qt to implement the following:
I have multiple identical widgets that I want to display once at a time.
I know that QToolbox exists, but the problem is the following:
I need to change the order in which the tabs or buttons appears (see image):
The widget that is set to an index does not stay at the same index, but should follow the header.
It doesn't have to be exactly as I describe, it's more the general idea of reordering my widgets that matters.
Thanks to all.
To change the order of the children, you can use QToolBox::removeItem() and QToolBox::insertItem(int index, QWidget *widget, const QString & text)
If you don't need random placement, but simply having the top widget moved to the bottom is sufficient, a couple of lines are enough to rotate the widgets :
QWidget *widget = toolBox->widget(0);
QString text = toolBox->itemText(0);
toolBox->removeItem(0);
toolBox->addItem(widget, text);

Resources