setValue("text.ncr_no", "test"); // $templateProcessor->setValue("corrective_action_ru", "teasdasdast"); /* $reflectionClass = new \ReflectionClass($templateProcessor); // Accessing the protected/private property $property = $reflectionClass->getProperty('tempDocumentMainPart'); $property->setAccessible(true); // Get the value of the property $xmlContent = $property->getValue($templateProcessor); $xmlContent = str_replace("corrective_action_ru", "test", $xmlContent); $property->setValue($templateProcessor, $xmlContent); */ /* $formTypes = ['date', 'time', 'text', 'textarea', 'radio', 'checkbox', 'select']; // Replace placeholders foreach ($replacements as $search => $replace) { foreach($formTypes AS $formType) { $isValidDate = false; if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $replace)) { // YYYY-MM-DD formatında tarih $isValidDate = true; } elseif (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $replace)) { // YYYY-MM-DD HH:MM:SS formatında tarih ve saat $isValidDate = true; } elseif (preg_match('/^\d{2}.\d{2}.\d{4}$/', $replace)) { // DD.MM.YYYY formatında tarih $isValidDate = true; } elseif (preg_match('/^\d{2}.\d{2}.\d{4} \d{2}:\d{2}:\d{2}$/', $replace)) { // DD.MM.YYYY HH:MM:SS formatında tarih ve saat $isValidDate = true; } if($isValidDate) { if (strtotime($replace)) { $dateTime = new DateTime($replace); // Eğer $replace saati de içeriyorsa if ($dateTime->format('H:i:s') !== '00:00:00') { $replace = $dateTime->format('H:i'); } else { $replace = $dateTime->format('d.m.Y'); } } } if (in_array($formType, ['radio', 'checkbox'])) { $replacePlaceHolder = $formType . '.' . $search . '.' . $replace; $okValue = '✓'; $cellValue = $okValue; $otherPattern = "/\{$formType\.$search\.[^}]*\}<\/w:t>/"; //$xmlContent = preg_replace($otherPattern, "", /$xmlContent); } else { $replacePlaceHolder = $formType . '.' . $search; // Note the curly braces $cellValue = $replace; $pattern = '/\{' . preg_quote($formType, '/') . '\.<\/w:t><\/w:r>]*>.*?<\/w:rPr>' . preg_quote($search, '/') . '<\/w:t>/'; dump($pattern); // $xmlContent = preg_replace($pattern, $cellValue, $xmlContent); $property->setValue($templateProcessor, $xmlContent); } // dump($pattern); // dump($cellValue); // preg_replace ile değişim } } */ $templateProcessor->saveAs($storagePath); } ?>