0

I would like to merge data into a text area. the mailing address that I would like to merge can have from 1 to 3 lines. I put this address in an array by splitting with '\n' and I would like to merge this array in the text area. How to display only non empty lines ?

Mike
  • 4,041
  • 6
  • 20
  • 37
  • actually my php code is : ` ... $TBS = new clsTinyButStrong; $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); $TBS->LoadTemplate(PATH_ROOT . 'template_courrier.odt'); $adresseRaw = "Adresse line 1\nAdresse Line2"; $arrAdr = explode('\n', $adresseRaw); $adr[] = array('line1' => $arrAdr[0],'line2' => $arrAdr[1],'line3' => $arrAdr[2]); $TBS->MergeBlock('adr', $adr); $output_file_name = 'courrier.odt'; $TBS->Show(OPENTBS_FILE, $output_file_name); ...` and my template_courrier.odt balise `[adr.line1;block=tbs:row]` – Sylvain GRIPPON Sep 17 '18 at 04:34
  • Your code is really hard to read. Please edit your question and put the code in there. – Mike Sep 17 '18 at 06:22

2 Answers2

0

I think the best approach would be to create the array the way you want to see it in the text area of the odt. Perhaps you need an additional step to remove "empty" elements of the array.

DinoCoderSaurus
  • 6,110
  • 2
  • 10
  • 15
0

I found a solution to resolve my problem. I replace the text area with a frame which accept to insert a table. So I can use [adr.line;block=tbs:row] in my ODT template. Thanks a lot