DXL script to copy object with pictures combined with strings - image

I wrote a dxl-script that reads out certain requirements in one module and place a new objct with some of its data in another module. Everything works just fine until there are pictures included. If there is a picture in the object heading and I want to copy this heading into another object, it simply fills in the text and skips the picture. Is there a way to cope with this?
Thanks in advance!

Suppose o1 is the source object with an "image" in its Object Text, while, o2 is the target object.
Let's copy all plain text, rich text and images(ole) from o1."Object text" to o2."Object Text":
Object o1, o2
string s = richTextWithOle(o1."Object Text")
o2."Object Text" = richText (s)

OLE Objects should be transferred to the destination attributes when you use the perm set (newObject.attrname, oldObject.attrname)

Related

Display Access data with image paths in Word document

I would like to make a Word product catalog from data stored in an Access 2007 database. I can of course use the "mail merge" function in Word for the text data, but I dont know how to make the images show up! They are they stored as file paths in Access and jpg-files in a directory on the hard drive. The images should have a special size, be right aligned to the text paragraphs so that the text is wrapping on the left side (see attached image).
This is possible, but works better in older versions of Word. Unfortunately, you don't mention which version you're using...
Anyway, the key to the question is to use an IncludePicture field to bring the picture in; pass the file path to the field using the MergeField (nested fields). You can find more information on the internet, for example: http://homepage.swissonline.ch/cindymeister/mergfaq1.htm#DBPic
The problem with an IncludePicture field is that it can't be wrapped. But if your version of Word is not too old, tables CAN wrap, so you put the IncludePicture field into a table that's a single cell. Position the table, wrap it, etc.

How to add inline graphics programmatically into a table cell in InDesign

I have a table in an InDesign document. I will to add an inline image to the first cell.
var myPics = File("/c/test.png"),
myDoc = app.activeDocument,
myPage = myDoc.pages[0],
myTable = myDoc.stories.everyItem().tables[0],
myCell = myTable.cells[0];
myCell.contents = myPics;
I expect there should be an image put into the cell, but the file address is filled instead. What should I do?
The contents of text objects in InDesign are not exact equivalents of actual formatted native InDesign text; they are always cast to and from simple Javascript text strings. Reading the contents discards all of InDesign's text attributes (for instance, text formatting, hyperlinks, bookmarks, XML markers, and all meta-objects such as images); and writing contents fills the destination with plain text, formatted with the default formatting of the text container at the location you place the text.
You cannot store a PNG file "in" a Javascript variable; not as a File object (it will not be parsed into the actual file's contents), and not as 'an image' (the contents will be treated as a text string, not 'meaning' anything).
The proper way is to use place, which can work on an InDesign document as a whole, in which case the file will be imported directly 'on' a page, or using a text location through a valid property such as its insertionPoints:
var myPics = File("/c/test.png"),
myDoc = app.activeDocument,
myPage = myDoc.pages[0],
myTable = myDoc.stories.everyItem().tables[0],
myCell = myTable.cells[0];
myCell.insertionPoints[0].place(myPics);
If you want make sure the contents of myCell is empty before placing, you can add
if (myCell.texts[0].length > 0)
myCell.texts[0].remove();
A warning on your use of everyItem(): when used this way, it is a live collection. A collection acts like an array, except that each element of the collection is 'seen' as the one and only object. Thus, you can do something like
myTable.cells.everyItem().contents = "hello!";
and the text will appear in every single cell, because of the everyItem() command. But since you already created a collection of tables -- myDoc.stories.everyItem().tables[0] will be a list of "the" first table in all of the current document's stories -- you will find, to your surprise, that all of these will suddenly contain hello as well.
You can see this if you place a copy of your current text frame on the same page and run my version of your script again. You will find it inserts the same image in both the tables!
Presumably you want to insert the image only once, in the first table, in the first story, on the first page. That would then be
myTable = myPage.stories[0].tables[0];

Ace code Editor with XML, hide specific xml attribute?

sorry, a newbie Q. Is it possible to hide a specific attribute throughout an XML doc?
I need a way to synchronize the contents of the editor with non-Ace objects elsewhere on the DOM (unfortunately a SWF file that loads the xml seperately...). I thought to label each node throughout the doc, e.g. tag='1', so that if a node with a given tag is manipulated in Ace, I can just use the tag to figure out what exactly was manipulated (and vice versa, update Ace when the xml is manipulated outside of Ace).
Best that people do not manipuate these tags, hence wanting to hide them from view.
Thanks :)
you can create folds to hide text, but i think for tracking changes it is better to use anchors which keep their position relative to text
a=ace.session.doc.createAnchor(row,col); // create
a.getPosition();
a.detach(); // remove when not needed anymore

javafx get exactly display text of cell in tableview

this seem a simple question but I can get only the real value of cell, not the display text because I use tableColumn.setCellFactory to change the display text of cell (use a method to convert from real value to my disired text), so the cell will have 2 values: display text and real value. I can re-convert but it's a silly solution :(
cell = t.getColumns().get(col).getCellData(row);
You can't access the renderer directly. Among the reasons is that you'd have to access the VirtualFlow that contains the display nodes. However, I give you an answer to the detail information you posted:
In order to make an agnostic export functionality (to CSV, XLS etc.)
it would be very convenient to request cell text, rather than data,
from a table view. Is that possible?
For any kind of export use a converter.
You never know what target format your users have. Your users could have different number format settings in your JavaFX application than what they have in Excel. Using Excel you need to get your JavaFX model data and set Excel's model data. Don't export using the view data and expect importing in Excel view would work, you'll run into problems.
Same for CSV. If you are e. g. on german localization, a 2 decimals number will look like 123,45 in your table instead of 123.45. So when you export the table's view data, you'll break your CSV format.
You won't get around exporting your model data via a proper converter.
You can use the getItems() method to access the model of the Table. Based on the row id you can get the DataModel for that row.
tblSampleTable.getItems().get(rowId);
So you have a reference to the DataModel, that means you can access all the data (actual data)
If you need to get the display text of TableView you can do this:
public void showAllText(TableView<?> tv){
for (Node r: tv.lookupAll(".table-row-cell")) {
for (Node c: r.lookupAll(".table-cell")) {
TableCell<?, ?> tc=(TableCell<?, ?>) c;
System.out.print(tc.getText()+" \t ");
}
System.out.println("");
}
}
Good luck.

How do I separate inline images and attaches using MAPI?

My program uses MAPI for working with Exchange mailboxes. The problem is if a user fires up Outlook, adds a file as an attachment and also opens Paint, selects a region there, copies it into clipboard and pastes into the message body the resulting message showns two attachments.
More specifically, the program calls IMAPIMessage::GetAttachmentsTable() to retrieve the attachments table and that table contains two objects. Is there a way a program can decide whether the "attachment" is really an attached file or a portion of inline content?
You will need to check whether the HTML body (through the img tag) refers to the attachment, either through img:cid and PT_ATTACH_CONENTS_ID property or though the file name (PR_ATTACH_LONG_FILENAME) or contnet location (PR_ATTACH_COMTENT_LOCATION).
The property you are looking for is PR_RENDERING_POSITION (0x370B0003). A -1 means that the attachment is a "normal" attachment and not in-line. If the value is anything other than -1, then that indicates an in-line attachment and the value is the position in the body that the attachment should be rendered at.
Here is the MSDN page describing it.
EDIT:
Dmitry, I do not agree with your comment. I have HTML email messages with in-line attachments and the PR_RENDERING_POSITION is working as described in the MSDN page I posted.

Resources