Skip to main content
Participating Frequently
August 4, 2011
Question

SDK API - Map Styles to Tags (StyleExportTagMaps)

  • August 4, 2011
  • 2 replies
  • 1062 views

Hello everybody,

I am developing a script to specialize the export tag mapping tool on CS5.5

I have found an object called "StyleExportTagMaps".

I would like to know two things:

        1. Wich object is its parent? i.e. from which Object should it be called from to create a new "StyleExportTagMap" Object. I have unsuccessfully tried to make the call from:
            • The Document Object:
              • myStyleExportTagMapA = myDocument.StyleExportTagMaps.add(...)
            • The Paragraph Object, which is the "MyStyleExportTag" object parent (the element, but not the list):
              • myStyleExportTagMapA = myDocument.paragraphStyles.item(myStyleAName).StyleExportTagMaps.add(...)
        2. What values should you send to the add method as parameters 1, 4, 5? i.e:
              1. exportTypeParam:String
              2. exportTagParam:String
              3. exportClassParam:String
              4. exportAttributesParam:String
              5. withPropertiesParam:Object

Thanks in advance,

Andres Mendoza

This topic has been closed for replies.

2 replies

Participating Frequently
August 12, 2011

Andres,

I have found this resource extremely helpful:

http://jongware.mit.edu/idcsjs5.5/pc_ParagraphStyle.html

here is the master path for CS 5.5 reference:

http://jongware.mit.edu/idcsjs5.5/

As for mapping the XML tags to styles I believe you have to map styles then call that map styles function. So for example:

xmlExportMaps.add(currentDocumentRef.paragraphStyles.item('myParaStyle'), currentDocumentRef.xmlTags.item('myXmlTag'));

xmlExportMaps.add(currentDocumentRef.paragraphStyles.item('myParaStyle2'), currentDocumentRef.xmlTags.item('myXmlTag2'));

...

currentDocumentRef.mapStylesToXMLTags();

currentDocumentRef is a variable pointing to the current document (I usually use app.activeDocument).

http://jongware.mit.edu/idcsjs5.5/pc_XMLExportMaps.html#add

Hope it helps

Participating Frequently
August 4, 2011

Hello Evreybody,

I have allready figuered out the object's parent, and it is definatelly a ParagraphStyleItem (but the class name doesn't begin with capital letter):

  1. The ParagraphStyle Object, e.g:
    • myStyleExportTagMapA = myDocument.paragraphStyles.item(myStyleAName).styleExportTagMaps.add( ...)

Now I would like to know, the argument values for the 1st, 4th and 5th parameters, the add method expect to recieve (I haven't been able to create a valid StyleExportTagMap object):

  • myStyleExportTagMapA = myStyleA.styleExportTagMaps.add("1st???", myXMLTagAName, "TheExportClass", "4th???", "5th???"); i.e:
      1. exportTypeParam:String
      2. exportTagParam:String
      3. exportClassParam:String
      4. exportAttributesParam:String
      5. withPropertiesParam:Object

Furthermore, what I really need to know is how do you specifically map a style to a specific Tag and class value. I was trying to use "xmlExportMaps.add()" and "mapStylesToXMLTags()" methods. It is possible to map a Style to a Tag with these methods, but I couldn't figure out how to set the class associated to the Tag (this is how I found the StyleExportMap Object, which I'm trying to use), e.g:

  • myStyleName: h2.fakecaps
  • Expected associated Tag name: h2
  • Expectede associated class name: fakecaps
  • Expected "template.css" values when exporting to ePub file: h2.fakecaps{...}

Thanks in advance,

Andres Mendoza

Participating Frequently
August 11, 2011

Hello Everybody,

A possible parameter for exportTypeParam (param1) is "EPUB"; maybe you could try with "PDF"

The Attributes String (param4) is composed by any combination of the ParagraphStyle properties.

I hope this would be usefull to anybody.

Ciao

Andres.