Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates: better support cross-format templates #4463

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JaumePujantell
Copy link

If form filling was used to create a file, do not add a template source. Otherwise Collabora Online creates the file again from the template.

Use the format option in 'transform-document-structure' to avoid an intermediate save in the template format, which might not be supported as a save format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part I understand and think is nice, we can skip writing to a temp file altogether since the transform document structure endpoint already can convert the document, it seems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff I don't really get, when I tried running it and creating a new file it doesn't quite work properly since the template service fillFields method expects a file to be handed to it; with these changes there isn't one. Can you explain a bit more the reasoning behind this or why it would be necessary? I don't completely understand

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I shouldn't have moved the empty template code path, thanks.

@JaumePujantell JaumePujantell force-pushed the private/jaumepujantell/potx-template branch from 24a0b2e to 6f42253 Compare February 13, 2025 14:57
if ($this->capabilitiesService->hasFormFilling()) {
try {
$filledTemplate = $this->templateFieldService->fillFields($templateFile, $event->getTemplateFields());
$filledTemplate = $this->templateFieldService->fillFields($templateFile, $event->getTemplateFields(), null, event->getTarget()->getExtension());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing a $

Suggested change
$filledTemplate = $this->templateFieldService->fillFields($templateFile, $event->getTemplateFields(), null, event->getTarget()->getExtension());
$filledTemplate = $this->templateFieldService->fillFields($templateFile, $event->getTemplateFields(), null, $event->getTarget()->getExtension());

If form filling was used to create a file, do not add a template source.
Otherwise Collabora Online creates the file again from the template.

Use the format option in 'transform-document-structure' to avoid an
intermediate save in the template format, which might not be supported
as a save format.

Signed-off-by: Jaume Pujantell <[email protected]>
@JaumePujantell JaumePujantell force-pushed the private/jaumepujantell/potx-template branch from 6f42253 to b6879ef Compare February 13, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants