@Björn_Eiríksson
I tried to convert one of the example projects (Templates) to API I to run on 2019.r.1- which the plugin is supposed to support.
I get the following error message when trying to run:
Sub Action() Handles Action
using EinhugurWord
Dim ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"
Dim f as FolderItem = GetOpenFolderItem(ft)
if f <> nil then
try
Dim doc as Document = Document.Open(f)
doc.ApplyFieldData("[CustomerName]", "Björn Eiríksson")
doc.ApplyFieldData("[Date]", DateTime.Now.ToString(DateTime.FormatStyles.Short))
doc.ApplyFieldData("[Functionality]", "Plugin, to Open, Edit, Create and save Word documents")
doc.ApplyFieldData("[Windows]", "Yes")
doc.ApplyFieldData("[macOS]", "No")
doc.ApplyFieldData("[Linux]", "Yes")
Dim dest as FolderItem = GetSaveFolderItem(ft, "My filled out Form.docx")
if dest <> nil then
doc.SaveAs(dest)
dest.Launch
end if
catch e as WordException
MsgBox e.Message
end try
end if
End Sub
So if the Iterator interface returns Auto in 2019r1 then I suppose the fix would be that I just remove the iterators when run on 2019r1. (Since the iterators are not strictly needed). Such removal is fairly quick task. (There will be release soon on the Xojo beta list for whats happening there, I could try to squeeze it into that).
Now the part that I am unsure about…is I have used Iterators in maybe 5-6 plugins, some of which come with API1 examples. (Like for example CoreClasses has iterators, which makes me not know what to think.
PS. Does the DateTime you use there support API1 ?
If you are going into the code anyway… I have an idea for a feature request that MIGHT be easy to implement…
I was thinking it would be nice to put a lot of Word Docs used as templates as blobs in a database … so the app can easily find/pull the “right” one out.
If it’s a local app i could put them (as well as and prefs) in an encrypted SQLite Database to prevent anyone from tinkering with them…
But unless I’m missing something, your code only can load Word docs from files… For this type of use It would be nice to be able to load the file content from the blob without having to create a tmp file on disk first.
Note though the word always has to create temp files regardless. Is because Zip archivers are not good at “modify” without temp files since it has to move data around in the Zip file.
But what your asking would definitely avoid double file caching.
what I do my export feature in my app is to save a html file as a word doc and I can open it with word app… just be careful using images that it does not do the width and heigh set in the html