Register Lost your password?

public function fAddElement(string type, array arrParamsElement = array())

Parameters

type

  • All kind of embedded elements: fAddLink, fAddImage, fAddGraphic, fAddTextBox

$arrParamsElement

  • The paramters of the embedded element that you specify in the parameter ‘type’

Examples

Example 1 Version Pro


require_once('../classes/cCreateDocx.inc');
$objDocx = new cCreateDocx();
$arrParamsLink = array(
'title' => 'Enlace a Google',
'link' => 'http://www.google.es'
);

$objLink = $objDocx->fAddElement('fAddLink', $arrParamsLink);
$arrParamsImg = array(
'name' => '../img/image.png'
);

$objImg = $objDocx->fAddElement('fAddImage', $arrParamsImg);
$arrDatos = array(
'legend1' => array(10,11,12),
'legend2' => array(0,1,2),
'legend3' => array(40,41,42)
);

$arrParamsGraphic = array('data' => $arrDatos,
'type' => 'pie3DChart', // pieChart, pie3DChart, barChart, colChart, bar3DChart or col3DChart
'title' => 'titulo'
);
$objGraphic = $objDocx->fAddElement('fAddGraphic', $arrParamsGraphic);

$texto = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';

$arrParamsText = array(
'b' => 'single'
);
$arrParamsBox = array(
'jc' => 'square'//square, through
);

$arrParamsTextBox = array(array('text' => $texto, 'args' => $arrParamsText), $arrParamsBox);
$objTextBox = $objDocx->fAddElement('fAddTextBox', $arrParamsTextBox);
$arrDatsList = array(
'Line 1',
$objLink,
$objImg,
$objGraphic,
$objTextBox,
'Line 2',
'Line 3',
);
$arrParamsList = array(
'val' => 1
);
$objDocx->fAddList($arrDatsList, $arrParamsList);

$objDocx->fCreateDocx('ejemplo_lista_image');

Example 2 Version Pro


require_once('../classes/cCreateDocx.inc');
$objDocx = new cCreateDocx();
$arrParamsLink = array(
'title' => 'Enlace a Google',
'link' => 'http://www.google.es'
);

$objLink = $objDocx->fAddElement('fAddLink', $arrParamsLink);
$arrParamsImg = array(
'name' => '../img/image.png'
);

$objImg = $objDocx->fAddElement('fAddImage', $arrParamsImg);
$arrDatos = array(
'legend1' => array(10,11,12),
'legend2' => array(0,1,2),
'legend3' => array(40,41,42)
);

$arrParamsGraphic = array('data' => $arrDatos,
'type' => 'pie3DChart', // pieChart, pie3DChart, barChart, colChart, bar3DChart or col3DChart
'title' => 'titulo'
);
$objGraphic = $objDocx->fAddElement('fAddGraphic', $arrParamsGraphic);

$texto = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';

$arrParamsText = array(
'b' => 'single'
);
$arrParamsBox = array(
'jc' => 'square'//square, through
);

$arrParamsTextBox = array(array('text' => $texto, 'args' => $arrParamsText), $arrParamsBox);
$objTextBox = $objDocx->fAddElement('fAddTextBox', $arrParamsTextBox);

$arrTable = array(
array(
'Title A',
'Title B',
'Title C',
'Title D',
'Title E'
),
array(
'Line A',
'Value 01',
$objTextBox,
$objLink,
$objImg,
$objGraphic
)
);

$arrParamsTable = array(
'TBLLOOKval' => 'ffff01E0',
'TBLSTYLEval' => 'Tablanormal',
'TBLWtype' => 'center',
'TBLWw' => '50',
'border' => 'single',
'border_sz' => 20,
'border_spacing' => 0,
'border_color' => 'ff0000',
'jc' => 'center',
'size_col' => 1200
);

$objDocx->fAddTable($arrTable, $arrParamsTable);
$objDocx->fCreateDocx('ejemplo_section');

Your comments