[New Super Plugin]: DocxBuilder-word template to docx

Hi @gilberto.mendes,
After running some tests on my end, everything seems to be functioning properly. Have you recently updated the plugin to the latest version?
If you have, I recommend trying to revert to the previous version to see if the issue persists. On the other hand, if you haven’t updated it yet, please consider updating it to the latest version. Additionally, it might be helpful to reload the page and try using a different browser.
Could you please give these suggestions a try and let me know if the issue persists? Your feedback will help us identify and resolve the problem more efficiently.

Keep in touch,
Bru

Hi @paul36,
I have tested your data and I have wonderful news for you.

In your case of study, the best configuration to make sure that the workflow is successfully completed, is to use the bubble formatting option “:formatted ad JSON-safe” like in the following screenshot:

Note that in the dynamic data you need to remove the brackets and the “:formatted ad JSON-safe” will do the rest. This option manages many cases, including your first issue related to too many brackets (remember :find&replace " with ').

Because the “:formatted ad JSON-safe” is super useful, I have added it also to the DocxBuilder testing page:

So, I tried generating a docx with your data and with this configuration it perfectly works.

I noticed that there where many mistakes in your JSON data. Make sure that you are not leaving any empty spaces when you a start new line (or starting two or more line consecutive) between keys.
For example in your case:

"Project Name": "Restarting Test 4",
  "Company Name": "GetPaulFord.com",
  "Name": "Paul Ford",
  "Email_Copy": "Subject Line Options:
1. Tap into the Power of Digital Transformation
2. Revolutionizing Workflow Efficiencies: Unleash the Potential
3. IT Transformation: The Game Changer in Business Environment
....

every time you find

 

is an error. In my screenshot I have pressed “enter” only one time to start a new line after the comma, followed by a new key .

I really hope that this one is THE ONE! :nerd_face:
Keep in touch
Bru

Hi Solvio!

It’s strange. Everything was working nicely. I’ve installed the DOCX to PDF and it also worked fine. I’ve then upgraded to the latest version. Don’t know for sure if the error began after ugrade to the latest version, but I’ve tried to roll back to the previous and it didn’t work.

This is a json sample:

{"Cliente":"ETRA","Data Proposta":"29 de  Janeiro  de  2024","Contato":"","Referencia":"Modelo Licença de Funcionamento","Objetivo":"Proposta Comercial para prestação de serviços de consultoria em Aprovações e Licenciamento Imobiliário para Construção da Estação Ambuitá que será operada pela CCR, com área de terreno de 5.000,00 m² e construção de 2.100,00 m², em imóvel localizado na Estrada Araçariguama, 09 - Estância São Francisco - Itapevi /SP.","ListaEscopo":[{"Escopo":"ALVARÁ DE APROVAÇÃO E EXECUÇÃO DE OBRAS (Construção):","ItensEscopo":[{"ItemDeEscopo":"Elaboração, formatação de Projeto Legal (PL), conforme padrão da prefeitura;"},{"ItemDeEscopo":"Obtenção de certidão de inexigibilidade junto ao COMAER, se necessário;"},{"ItemDeEscopo":"Juntada de documentos, para autuação dos processos"},{"ItemDeEscopo":"Preenchimento de requerimentos"},{"ItemDeEscopo":"Emissão de RRT de projeto legal, devidamente quitada"},{"ItemDeEscopo":"Acompanhamento do processo, incluindo reuniões técnicas na prefeitura, bem como atendimento de comunique-se até a aprovação do processo."}]}],"EntregaDocumentos":"Os documentos serão por e-mail em arquivo eletrônico (DWG e PDF), no tamanho A1 ou A0 e A4 para o cliente. Ao final do processo de aprovação, a planta atualizada com todo o atendimento de comunique-se também será disponibilizada em DWG.","Responsabilidades":[{"Responsabilidade":"Matrícula atualizada do imóvel;"},{"Responsabilidade":"Memorial Descritivo do projeto;"},{"Responsabilidade":"Projeto Executivo de Arquitetura atualizado em DWG;"},{"Responsabilidade":"Contrato de Locação;"},{"Responsabilidade":"Contrato Social"},{"Responsabilidade":"Documento do responsável legal pela Empresa, bem como ATA de nomeação;"}],"Revisoes":"Foram consideradas somente revisões para atendimento de comunique-se.","Prazos":[{"Prazo":"Vistoria","PrazoDescricao":"5 dias após o recebimento de toda a documentação relacionada no item 4"},{"Prazo":"Aprovação","PrazoDescricao":"Dependerá do tramite interno da Prefeitura local"}], "ItensNaoInclusos":[{"ItemNaoIncluso":"Conversão de arquivos em 3D (Revit - BIM) para 2D (AutoCad);"},{"ItemNaoIncluso":"Fornecimento de projetos legais em 3D;"},{"ItemNaoIncluso":"Levantamento topográfico planialtimétrico cadastral e ART de execução do serviço;"},{"ItemNaoIncluso":"Levantamento das espécies arbóreas/ inventário arbóreo, projetos para supressão e compensação e/ou ART de execução do serviço;"},{"ItemNaoIncluso":"Projeto viário (geométrico, drenagem, pavimentação e sinalização); "}] ,"Servicos":[{"Servico":"ALVARÁ DE APROVAÇÃO E EXECUÇÃO DE OBRAS","ValorServico":"30.000,00"}
 ,{"Servico":"PROJETO DE PROTEÇÃO E COMBATE À INCÊNDIO – PPCI","ValorServico":"18.500,00"}
 ,{"Servico":"AUTO DE VISTORIA DO CORPO DE BOMBEIROS – AVCB","ValorServico":"6.500,00"}
 ],"TotalServicos":"55.000,00","Honorarios":[{"Honorario":"Arquiteto Sênior","ValorHonorario":"500,00"},{"Honorario":"Arquiteto Pleno","ValorHonorario":"250,00"}],"Parcelas":[{"Parcela":"Sinal - mobilização de equipe","Porcentagem":"20,00%"}],"Condicoes":"sdfsdfgsdfgsdfg"}

And this is the docx text

São Paulo, {Data Proposta}.


{Cliente}
A/C.: {Contato}


Assunto: Proposta Técnica e Comercial

Ref.: {Referencia}


1.	OBJETIVO:
{Objetivo} 

ESCOPO:
 
{#ListaEscopo}
{Escopo}
{#ItensEscopo}
 	{ItemDeEscopo}
{/ItensEscopo}

{/ListaEscopo}

2.	ENTREGA DOS DOCUMENTOS
{EntregaDocumentos} 


3.	RESPONSABILIDADES DA CONTRATANTE
A Contratante deverá fornecer à ETRA:

{#Responsabilidades}
    {Responsabilidade}
{/Responsabilidades}
 
{Revisoes}

5.	 PRAZOS

{#Prazos}{Prazo}:  {PrazoDescricao}
{/Prazos} 


{#ItensNaoInclusos}
•	{ItemNaoIncluso}
{/ItensNaoInclusos}


DESCRIÇÃO DOS SERVIÇOS	VALORES
{#Servicos}{Servico}	{ValorServico}{/Servicos}
TOTAL  	{TotalServicos}
	

DESCRIÇÃO	VALORES
{#Honorarios}{Honorario}	{ValorHonorario}{/Honorarios}

8.	CONDIÇÕES DE FATURAMENTO:
{#Parcelas}{Parcela}	{Porcentagem}{/Parcelas}

{Condicoes}

I will try to rebuild everything, testing field by field.

An update.

I put the JSON on your app, as well as my template and it worked!

I created a new page with the plugin, sending the same json and docx that worked, got the message “There was a problem generating your file. Please verify your file type and try again.” . However, when I looked in the file manager, the file was created sucessfully

Finally, i’ve deleted the docxbuilder object from the page and dragged a new one. Worked perfectly. Proving that technology is more a religion than a exact science.

Hi there,
yeah, you’re right; sometimes we lose our minds over simple things.
Anyway, I am glad that everything is working perfectly now.
By the way, I was thinking that one of the reasons might have been a plugin going in conflict with another one.
If it happens again, try to have a look if this is the case, and give me the name of the plugin so that I can try and fix the issue.
Thank you for using our plugin; it is always useful to get feedback.
If we can support your business in any other way, please let us know
Keep in touch
Bru

Thanks so much, Bru! Excited to try this all. I’ll let you know how it goes. Fingers crossed!

I think it could be a conflict between plugins.

I will install them in two other apps, if I have any issues I let you know.

Thanks for the support! Best regards from Brazil!

BRU! It freakin’ WORKED!
I couldn’t be happier! It’s got my headers, my logo, and my bodies. Well done, sir!
Ha HA! You made my day!
Thanks!
Paul

Hi Paul,
YAY!!! I am super happy for you!
Good work!!
Glad to have been helpful!
Keep me in the loop!
Brunella xx

Hi, Brunella! I’ve been playing with this and have one question: Do you know if there’s a way in my template to collapse sections that don’t have any text in them? So, for instance if I don’t have any copy associated with the “email” dynamic copy, that I can not show that whole section?

And thanks again for your incredible persistence getting this going!

Hi @paul36 ,
I’m not sure if I understand your question correctly, could you give me an example please?

Thank you
Brunella

Sure! The documents I’m sending using DocxBuilder sometimes include all the copy headings possible, but more often, some will be blank, like in the screenshot below:

I’d love to be able to collapse the empty ones like this one so that page (or that “Thank You Email” section) is not visible in the doc.

Do you have any ideas on how I could do that?

Thanks so much!
Paul

Well!
You have many different ways to obtain this result.
The fist and very simple solution to implement is to modify your template, adding loop tag (for more info I advise you to check the documentation at DocxBuilder page → Most used tags)
So, your template syntax will need to change from this:

to

Basically, by using the same key to define a loop and content (or value), if the value of the key is empty, not only the key, but also the loop, will not be shown. The result will be that all content in the loop tag will not appear in you output docx.

This is a little trick :wink:
Bru

Thanks, Bru! I feel like it’s so close. I’m getting this error:

My new Template looks like this:

With, for instance, “Email Copy” in bold as the header for the section, and {Email_Copy} as the actual copy from my Bubble database.

Using the DocxBuilder uploaded address here in the Bubble workflow:

Any thoughts on what I’m doing wrong? I feel like it’s obvious, but I just can’t see it.

Thanks so much!
Paul

Hi,
this error occurs typically when there are syntax errors in the docx template.
Please check your template syntax. Make sure that your keys in the docx template:

  • don’t have space added for e.g. {# Key} or {#Key } or { #Key} or { #Key } (also for close tag)
  • all loops are always opened “#” and closed “/” with correct tag
  • every loop is opened and closed with the same key exactly (remember that the tag is CASE-SENSITIVE)

So, the correct notation for e.g. is
{#Key}{/Key}

Good luck!!!
Bru

You’re right! The smallest thing sets off a flurry of error messages. I had one capitalized filename wrong letter wrong, now it looks just as I thought it could. Thanks so much and have a great weekend!
Paul

Suggestion to a new new super plugin:

Insert data into an Excel spreadsheet just like DocxBuilder does.

Hi Paul,
no worries, it’s a pleasure.
Bru

Thank you Gilberto!
Let’s keep in touch.
Bru

Hello! It’s me again.

I would like to have some advice regarding rich text and the docx plugin.

My goal is to open a rich text editor, allowing the user to enter text with bold, italic, different text sizes, colors and bullet lists. Then this rich text will be inserted into a docx template.

Do you have a best pratice or an example? Do I send the bb code? Do I need to convert to HTML? How to securely wrap the code in json?

On a previous project i split everything in different fields, since I needed more control over the layout.