Einhugur Word Plugin on 2019R1.1

@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:

Does this mean I have to use a new Xojo version.

My Code in the button action event is just:

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

Thanks,
-karen

Hmmmm

Interesting error.

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 ?

Yes without an issue… But of course I had to take the Word plugin out of the plugin folder to compile it.

-Karen

Lets aim for getting the one on the beta list out without Iterator support then. That should then make it good.

Only loss is that For each don’t work on it then. (when using 2019r1). But For loops of course work.

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.

-Karen

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.

Hi Bjorn,
Is it possible to convert an html content to word format.

Well you can read the Html and try to interpret it and then feed into the Word document.

Other than that then its not Html converter no.

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