Copy link to clipboard
Copied
I've been unable to find any info on scripting the mapping of styles to tags.
I currently have a standing InD file that has all the styles mapped to tags. I've been using the Load button on the "Map Styles to Tags" dialog to load the
mappings into the file I want to export. This works OK but unfortunatly loads the ENTIRE style from the standing file, including formatting. I want JUST the style mappings to the tags from the standing file and maintain the formatting of the file I'm getting prepared for export.
I'd be most grateful if someone could supply a small code snippet or even some info as to where to look for scripting the mapping.
Related to that I'd like to script finding styles that are NOT mapped to any XML tag for when a new style if introduced.
Many thanks for reading,
Ken
main();
function main() {
var doc = app.activeDocument;
var xm1 = doc.xmlExportMaps.add( "H2", "h2");
var xmaps = doc.xmlExportMaps;
$.writeln("count maps: " + xmaps.length);
for (var m = 0; m < xmaps.length; m++) {
var a = doc.xmlExportMaps.item(m);
for (var n in a ) {
if (a
.hasOwnProperty('name')) { $.writeln( n + ": " + a
.name ); } else {
$.writeln( n + ": " + a
); }
}
$.writeln( "----" );
}
}
Does that hel
...Copy link to clipboard
Copied
main();
function main() {
var doc = app.activeDocument;
var xm1 = doc.xmlExportMaps.add( "H2", "h2");
var xmaps = doc.xmlExportMaps;
$.writeln("count maps: " + xmaps.length);
for (var m = 0; m < xmaps.length; m++) {
var a = doc.xmlExportMaps.item(m);
for (var n in a ) {
if (a
.hasOwnProperty('name')) { $.writeln( n + ": " + a
.name ); } else {
$.writeln( n + ": " + a
); }
}
$.writeln( "----" );
}
}
Does that help?
Copy link to clipboard
Copied
Oy! That's a bit embarrassing.
Thanks so much for the illustration, every thing is working fabulously, mapping and checking for unmapped.
So, any idea of there is a way to change the color that's displayed for the XML "markings"? Not critical but it would be nice to be able to set them to something so they're consistent.
Thanks again for the example,
Ken