DataMerge for shapes in Indesign
Learn / Forums / General InDesign Topics / DataMerge for shapes in Indesign
- This topic has 7 replies, 5 voices, and was last updated 8 years, 9 months ago by Colin Flashman.
-
AuthorPosts
-
-
June 25, 2015 at 1:00 am #76242Mohad DMember
Hi Ppl, I’m new to In-design and trying to accomplish the following.
I want to create a text box in a particular height and width while using the data merge feature. For example this is the data source :
Name Country Size
John US 20cmWhen I use this data source, it should fill in the above detail on the placeholder and create a box with size 20cm with the country name on it. how do i do this?
-
June 25, 2015 at 3:32 am #76244Masood AhmadParticipant
Welcome to the forum, Mohad.
Try these:
https://creativepro.com/automating-data-handling.php
https://creativepro.com/data-merging-part-2.php
https://creativepro.com/data-merging-part-3.php
https://creativepro.com/using-data-merge-to-create-a-table-for-a-directory.php
https://creativepro.com/data-merge-into-inline-anchored-objects-so-they-flow-in-a-story.php -
June 25, 2015 at 4:58 am #76246Loic AigonMember
Hi Mohad,
Nor Datamerge, nor XML import will let you rearrange frame dimensions on the fly. It’s only a matter of Scripting here (given that you want to set a specific dimension. Otherwise frame options can help).
-
June 29, 2015 at 2:16 am #76304Mohad DMember
can someone help me with the script if i give the dimensions ?
-
June 30, 2015 at 4:05 am #76323Eugene TysonMember
The Text Frame can autosize on importation of the data merge, but you can’t dictate the size.
https://creativepro.com/keeping-long-fields-text-line-data-merge.php
Best to find the longest size, set the font size to fit this at the required size. Then use the data merge feature.
-
July 1, 2015 at 8:59 pm #76374Mohad DMember
Thanks guys..will try it out and keep you posted
-
July 3, 2015 at 4:49 am #76391Loic AigonMember
Try this :
var fn = function() {
var doc, fgp = app.findGrepPreferences.properties,
found, n, errors = 0, hu, vu;if ( !app.documents.length) return;
doc = app.activeDocument;
hu = doc.viewPreferences.horizontalMeasurementUnits;
vu = doc.viewPreferences.verticalMeasurementUnits;doc.viewPreferences.horizontalMeasurementUnits =
doc.viewPreferences.verticalMeasurementUnits =
MeasurementUnits.POINTS;app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = “\\d+cm”;
found = doc.findGrep();
n = found.length;while ( n– ) {
!doResize ( found[n] ) && errors++;
}app.findGrepPreferences.properties = fgp;
doc.viewPreferences.horizontalMeasurementUnits = hu;
doc.viewPreferences.verticalMeasurementUnits = vu;alert( errors? errors+” errors occured on “+found.length+” occurences.” : “Everything was fine.” );
}var doResize = function(text) {
const ap = AnchorPoint.TOP_LEFT_ANCHOR,
cs = CoordinateSpaces.INNER_COORDINATES,
rm = ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH;
var ptf, uv, w, props;if ( !text.parentTextFrames.length
|| !text.parentTextFrames[0].isValid
|| !/.+cm$/i.test(text.contents) ) return false;uv = new UnitValue ( text.contents.slice (0, -2), “cm” ).as(“pt”);
ptf = text.parentTextFrames[0];
props = getPageItemProperties ( ptf );
ptf.resize ( cs,ap, rm, [uv, props.height] );
return true;
}var getPageItemProperties = function(pi) {
var points = pi.paths[0].entirePath,
n = points.length, i = 0,
dummy, bounds, w, h;
const cs = CoordinateSpaces.INNER_COORDINATES;
var newPoints = [];while ( i < n ) {
newPoints [ i ] = pi.resolve ( points[i], cs )[0];
i++;
}dummy = app.activeDocument.polygons.add();
dummy.paths[0].entirePath = newPoints;
bounds = dummy.geometricBounds;
w = Math.round ( Math.abs ( bounds[3]-bounds[1])*1000)/1000;
h = Math.round ( Math.abs ( bounds[2]-bounds[0])*1000)/1000;
dummy.remove();return {width:w, height:h};
};fn();
-
July 19, 2015 at 7:02 am #76682Colin FlashmanParticipant
You could do this if you were using the chartwell bars font AND the auto-resize as Eugene suggests in his post.
You would have to change the width of the chartwell bar font using the character scaling.
See this post https://creativepro.com/chartwell-bars-scalable-data-merge-shapes.php to get an idea of what i’m talking about.
Catch is, chartwell isn’t free – US$139 last time i checked.
-
-
AuthorPosts
- You must be logged in to reply to this topic.