Using the Open-XML-SDK-Plugin for MvvmCross is quite simple. The plugin injects the IWordManager interface into the IoC container. Each resolve to IWordManager from the Mvx.Resolve() will create a new instance of the service.
The API of WordManager is very easy to understand and to use.
In order to open a template, call the OpenDocFromTemplate method
var resourceName = "<Set full template file path here>"; // ex : C:\temp\template.dotx
var finalFilePath = "<Set saved new document file path here>"; // ex : C:\temp\createdDoc.docx
using (var word = Mvx.Resolve<WordManager>())
{
word.OpenDocFromTemplate(resourceName, finalFilePath, true);
word.SaveDoc();
word.CloseDoc();
}
Using the name of the database and the folder on the client device where to store database files:
var resourceName = "<Set full template file path here>"; // ex : C:\temp\template.dotx
var finalFilePath = "<Set saved new document file path here>"; // ex : C:\temp\createdDoc.docx
using (var word = Mvx.Resolve<WordManager>())
{
word.OpenDocFromTemplate(resourceName, finalFilePath, true);
word.SaveDoc();
word.CloseDoc();
}
To be complete...