Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Export to word templat...
Finance forum
Unanswered

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

Posted on by 56

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
    Maris Sausins 56 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
    huijij 19,803 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
    Maris Sausins 56 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
    huijij 19,803 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
    Maris Sausins 56 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
    huijij 19,803 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.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans