[OfficeUtils] Object reference not set to an instance of an object.

[OfficeUtils] Object reference not set to an instance of an object.

  
Forge Component
(7)
Published on 21 Nov (13 days ago) by Elena Novozhilova
7 votes
Published on 21 Nov (13 days ago) by Elena Novozhilova
Hi, I receive this error when trying to export a word document.

I've debugged and the error happens on the Word_Export_GenerateFile action.

Any idea's what is causing the error?

I've also noticed that this doesnt work if you have your placeholders in tables - Is this something I have done wrong or a limitation?

Thanks

Hi Chris,

The error you are getting is pretty generic (a null pointer exception). Can you isolate the issue in a small espace so that I can take a look?

I think that replace placeholders on tables is not possible, at least that was not a concern while developing the first release of the component. The second release already provides the feature to export tables to word, which should be what you are looking for. I will be publishing this new release today or tomorrow.

Thanks

Hi Bruno,

I think I found the issue, and it was whenever I included an image on the document which was strange, as I have other images that work, but this one inparticular was causing the issue. Maybe because I have right aligned the image it messes with the xml output?

I also have issues with some #tags. I've managed to get some working, then not working again...

I've made sure there are no space's after the #tag and but like I say, its strange as some work but some don't....

I remember when I was developing with xpages I was working with a similar approach, and things didnt work if the spellchecker was enabled as it messed with the xml output, so made sure I have disabled that also....


Hi Chris,

The release that allows exporting tables to word documents is now available.

I would not be expecting for an image alignment to mess with the word export process. If you send me the problematic word document template I will take a look once I have a chance.

When I was testing this component I also experience the issue of some placeholders being replaced and some others don't. In my case this was caused by the placeholder being stored in the word file in more than one run tag (e.g. run1 = '#Pos', run2 = 'ition'), while the mecanism is searching for a match of a specific placeholder (#Position) on a single run. Word does this split automatically if you remove chars or add chars to the placeholder of your document. So I would recommend you to try deleting the problematic placeholders and write them again.

Thanks
Hi Bruno,

I am also having issues with trying to format the output.

Our requirement is to produce various documentation for loan applications. I have attached 1 such document with a few placeholders in. This document doesn't work and I get the same error as Chris. As soon as I strip out all of the formatting (ie remove tables for formatting etc) it works. But this is no good. Is there any way of being able to produce something like the attached?

Debra
Hi Debra,

The current version of OfficeUtils doesn't include the functionality to replace text placeholders insite tables and textboxes. And apparently the presence of a textbox in the document template causes the error you mentioned.

In the meanwhile I created a new release of the component which includes the feature to replace placeholders inside tables. I will make the new release available between today and tomorrow.

Looking at your document template the addition of this feature should be enough for achieving your goal. Just remember to get rid of all textboxes and use tables instead.

As soon as I have availability I will focus on another release to allow the replacement of placeholders inside textboxes.

Thanks

Bruno
Hi Bruno,

you really have made my day!

Can't wait to use the new release and you are right the addition of just being able to replace placeholders in tables will meet my needs completely!

Thank you so much

Debra
Hi Debra,

I just made available the new release which allows to replace placeholders inside tables.

Please test it, and if you have any issues just let me know.

Thanks,

Bruno
Hi Bruno,

I've downloaded and tested and working absolutely fine.

Thank you so much

Debra
Hi Bruno,

I'm having issues again. I have a template with some placeholders in within tables. Some are getting populated and some arean't. To see if they were working properly I stripped them out of the table completely and just had them on separate lines. They all pulled through fine stripped out of the table!

I'm attaching the template to see if you can spot anything.

Also, images such as logos in headers cause xml errors. do you know of a way i can get around this?

Debra
I'm uploading a second file showing which ones haven't pulled through.

Debra
Hi Bruno,

ignore the placeholder issue. I just recreated the table from scratch and then added the placeholders back in and it works.

The images not working in the header is still an issue though.

Debra
Hi Debra,

Sorry for the late response. I was on vacations.

Once I have a chance I will try to replicate the issue related with having images in headers, I didn't test that usage before.

Bruno
Hi Bruno,

don't suppose you have had a chance to look at this? 

Debra
Hi Debra,

After a lot of struggle, I was able to figure out the issue with providing images on template word document headers. I also used the opportunity to change the component to allow the replacement of placeholders inside header and footer.

As soon as I finish testing the new version of the component I will release it. I'm missing all the testing for the Java stack (for the .NET stack is already complete) and I think I should be able to get it done during this week.

Bruno




Hi Debra,

I just released the new version of the component.

If you have any issues please let me know.

Bruno
Thanks

I'll give it a go tomorrow and let you know.

Really appreciate this

Debra
Hi Bruno,

this is absolutely wonderful.

Thank you

Debra