M2Doc | M2Doc technology enables the generation of Office Open XML
kandi X-RAY | M2Doc Summary
kandi X-RAY | M2Doc Summary
The M2Doc technology enables the generation of Office Open XML documents from models. These plugins are released under the EPL Open-Source License. Visit our web site :
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create the page controls
- Create a model
- Initialize the editing domain for the model editor
- Set the current content viewer
- Create the control
- Creates the M2Doc version
- Validates the page with the given custom properties
- Creates the controls for the generation
- Creates the template URI
- Initializes the HTML color mapping
- Override this method to validate the repetition
- Create the EObject for the given class
- Produces an HTML page of the HTML page
- Create the contents of the wizard
- Creates the custom area
- Validates the condition
- Set the value of the feature
- Add a generation
- Creates the components
- The NotificationListener interface
- Returns the case of the given class
- Performs the actual work
- Executes the command
- Create the variables for this control
- Determine if the next token is a valid token
- Returns the next token
M2Doc Key Features
M2Doc Examples and Code Snippets
Community Discussions
Trending Discussions on M2Doc
QUESTION
I've applied the guidance on programmatic usage of M2Doc (also with this help) to successfully generate a document via the API, which was previously prepared by using the M2Doc GUI (configured .docx plus a .genconf file). It seems to also work with a configured .docx, but without a .genconf file.
Now I would like to go a step further and ease the user interface in our application. The user should come with a .docx, include the {m:...} fields there, especially for variable definition, and then in our Eclipse application just assign model elements to the list of variables. Finally press "generate". The rest I would like to handle via the M2Doc API:
- Get list of variables from the .docx
- Tell M2Doc the variable objects (and their types and other required information, if that is separately necessary)
- Provide M2Doc with sufficient information to handle AQL expressions like
projectmodel::PJDiagram.allInstances()
in the Word fields
I tried to analyse the M2Doc source code for this, but have some questions to achieve the goal:
- The parse/generate API does not create any config information into the .docx or .genconf files, right? What would be the API to at least generate the .docx config information?
- The source code mentions "if you are using a Generation" - what is meant with that? The use of a .genconf file (which seems to be optional for the generate API)?
- Where can I get the list of variables from, which M2Doc found in a .docx (during parse?), so that I can present it to the user for Object (Model Element) assignment?
- Do I have to tell M2Doc the types of the variables, and in which resource file they are located, besides handing over the variable objects? My guess is no, as using a blank .docx file without any M2Doc information stored also worked for the variables themselves (not for any additional AQL expressions using other types, or .oclAsType() type castings).
- How can I provide M2Doc with the types information for the AQL expressions mentioned above, which I normally tell it via the nsURI configuration? I handed over the complete resourceSet of my application, but that doesn't seem to be enough.
Any help would be very much appreciated!
To give you an impression of my code so far, see below - note that it's actually Javascript instead of Java, as our application has a built-in JS-Java interface.
...ANSWER
Answered 2021-Aug-23 at 13:01No the API used to parse an generate don't modifies the template file nor the .genconf file. To modify the configuration of the template you will need to use the TemplateCustomProperties class. That will allow you to register your metamodels and service classes. This instormation is then used to configure the IQueryEnvironment, so you might also want to directly configure the IQueryEnvironment in your code.
The generation in this context referes to the .genconf file. Note The genconf file is also an EMF model, so you can also craft one in memory to launch you generation if it's easier for you. But yes the use of a .genconf file is optional like in your code example.
To the list of variables in the template you can use the class TemplateCustomProperties:
- TemplateCustomProperties.getVariables() will list the variables that are declared with their type
- TemplateCustomProperties.getMissingVariables() to list varaibles that are used in the template but not declared
You can also find le list of used metamodels (EPackage nsURIs) and imported services classes.
The type of variables is not needed at generation time, it's only needed if you want to validate your template. At generation time you need to pass a map from the variable name to its value as you did in your example. The value of a variable can be a any object from your model (an EObject), a String, an Integer, ... If you want to use something like oclIsKindOf(pkg::MyEClass) you will need to register the nsURI of pkg first see the next point.
The code you provided should let you use something like projectmodel::PJDiagram.allInstances(). This service needs a ResourceSetRootEObjectProvider() that is initialized in M2DocUtils.getQueryEnvironment(). But you need to declare the nsURI of your metamodel in your template (see TemplateCustomProperties). This will register it in the IQueryEnvironment. You can also register it yourself using IQueryEnvironment.registerEPackage().
This should help you finding the missing parts in the configuration of the AQL environment. Your code seems good and should work when you add the configuration part.
QUESTION
What is the M2DOC Eclipse Capella command to maximize an image in a Word page?
I try this code:
...ANSWER
Answered 2021-Apr-27 at 09:52You are using the DRepresentation to call the service getHeight(), you should call it on the MImage:
QUESTION
I'm tried to generate document template using m2doc. In my template I want to use some sirius services.
It'works manually. I want to do it programmatically in a custom service.
Can i generate document with sirius service directly from the DocumentTemplate without generation? How can I set the “SiriusSession” option?
...ANSWER
Answered 2020-Jul-27 at 08:47So I use a Generation (genconf file)and set the sirius session like this :
QUESTION
So I created a simple service with a single class, without constructor : services.RecursiveQuery
and added it as a plugin to my Eclipse instance as described in this question.
According to the documentation the next step would be to import it in my template file file so I tried this:
...ANSWER
Answered 2020-Mar-28 at 22:22The M2Doc documentation may be unclear on this point: {m:import...}
is not a valid statement in a M2Doc template file. It should be used in MS Word document properties, not in the docx template file.
You should use the template properties wizard to change imports along with the solution you mentionned here.
For a better understanding of how to use custom services you can check examples in M2Doc sources.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install M2Doc
You can use M2Doc like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the M2Doc component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page