Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Export to word template, an error occured during the export.

(0) ShareShare
ReportReport
Posted on by 11

Hello, everyone!

I have a custom data entity with root DS and join data sources, and I want to export data to word template, but I am getting and error "an error occured during the export".

Tried to recreate the data entity, made it simplier with almost no joined data sources, just DAVS, removed all methods, but still getting the same error.

pastedimage1676287436352v1.png

pastedimage1676287473911v2.png

when debugging, stack trace to error msg:

pastedimage1676287681401v3.png

getting to line 137, then jumps over to catch block and displaying error

pastedimage1676288410684v5.png

in "renderWordTemplate" method of DocuTemplaterender class

pastedimage1676288172204v4.png

after line 557 result variable I guess is true, because it doesn't get into "if" block, but I can't realy view the value of the result in watch.

In the catch block, I'm getting error:

pastedimage1676288569509v6.png

Tried some different data entities on different forms, export to word works perfectly fine. Can't figure out what is the problem.

Maybe someone can help me.

Any help appreciated!

Kind Regards,

Maris

  • Maris Sausins Profile Picture
    11 on at
    RE: Export to word template, an error occured during the export.

    Sorry for the late response!

    I'm always doing full build with DB sync, when creating a new entity. Then refreshing the entity list.

    My colleague found out that changing "Date, time, and number format" to "en-us" in user option (maybe some other formats works too) export to word is working perfectly fine.

    Don't really know why is that and how to fix it, but we think that problem is causing a field of type real which is in primary index. When used "en-us" number format then the real number is formated using dot like "1.0", but when using "lv" number format the real number is formated using comma like "1,0".

    Any help appreciated!

  • huijij Profile Picture
    19,811 on at
    RE: Export to word template, an error occured during the export.

    When you create entity, you must sync a database when you build entities. On the Visual Studio toolbar, click Build > Build Solution to build the project. Verify that the build doesn't contain any errors. If the error persists, you can recreate a new entity.

  • Maris Sausins Profile Picture
    11 on at
    RE: Export to word template, an error occured during the export.

    Standard entities and my other custom entities working fine, "documentGenerator.GenerateDocument(params)" returns "true", only export to word not working for this particular entity, but "Open in excel" functionality working perfectly fine.

  • huijij Profile Picture
    19,811 on at
    RE: Export to word template, an error occured during the export.

    Since it is skipped, it should not be executed to this piece of code. Do you also encounter this problem when exporting other standard entities or just this custom entity?

  • Maris Sausins Profile Picture
    11 on at
    RE: Export to word template, an error occured during the export.

    Hi, Judy!

    Thanks for your response! Can you please explain, how do you mean to print out the value of the variable?

    When I'm debugging the "renderWordTemplate" method of DocuTemplaterender class, cursor just jump to line 563, and I can't see the value of variable result.

    Kind Regards

    Maris

  • huijij Profile Picture
    19,811 on at
    RE: Export to word template, an error occured during the export.

    Hi,

    I think when you don't know the value of the variable of line 557, you can try to print it out. Then you can rebuild your project with DB sync and try again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,125 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans