Add support create & save pdf forms

This commit is contained in:
Oleg Korshul
2024-06-05 14:41:41 +03:00
parent 586455310a
commit c7612a259d
6 changed files with 16 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#define OFFICESTUDIO_FILE_DOCUMENT_DOTX OFFICESTUDIO_FILE_DOCUMENT + 0x000c
#define OFFICESTUDIO_FILE_DOCUMENT_OTT OFFICESTUDIO_FILE_DOCUMENT + 0x000f
#define OFFICESTUDIO_FILE_DOCUMENT_HTML OFFICESTUDIO_FILE_DOCUMENT + 0x0012
#define OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF OFFICESTUDIO_FILE_DOCUMENT + 0x0017
#define OFFICESTUDIO_FILE_PRESENTATION 0x0080
#define OFFICESTUDIO_FILE_PRESENTATION_PPTX OFFICESTUDIO_FILE_PRESENTATION + 0x0001

View File

@ -357,6 +357,7 @@ namespace NSDoctRenderer
/**
* Creates a new file. The type of the file which will be created needs to be set.
* @param type The type of the file to be created set as a hexadecimal integer for the C++ code or docx, xlsx or pptx for the .docbuilder script file (see AVS_OFFICESTUDIO_FILE_XXX values).
* Possible values for wchar_t version: "docx", "pptx", "xlsx", "pdf", "form"
* @return True if the operation is successful
*/
bool CreateFile(const int& type);

View File

@ -50,7 +50,8 @@ namespace docbuilder_net
TXT = MASK + 0x0005,
DOTX = MASK + 0x000c,
OTT = MASK + 0x000f,
HTML = MASK + 0x0012
HTML = MASK + 0x0012,
OFORM_PDF = MASK + 0x0017
};
public enum class Spreadsheet : int

View File

@ -559,6 +559,7 @@ class FileTypes:
DOTX = _MASK + 0x000c
OTT = _MASK + 0x000f
HTML = _MASK + 0x0012
OFORM_PDF = _MASK + 0x0017
class Presentation:
_MASK = 0x0080

View File

@ -1440,7 +1440,11 @@ namespace NSDoctRenderer
bIsNoError = (0 == this->OpenFile(_builder_params[0].c_str(), _builder_params[1].c_str()));
else if ("CreateFile" == sFuncNum)
{
if (L"docx" == _builder_params[0] || L"docxf" == _builder_params[0] || L"oform" == _builder_params[0])
if (L"docx" == _builder_params[0] ||
L"docxf" == _builder_params[0] ||
L"oform" == _builder_params[0] ||
L"pdf" == _builder_params[0] ||
L"form" == _builder_params[0])
bIsNoError = this->CreateFile(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX);
else if (L"pptx" == _builder_params[0])
bIsNoError = this->CreateFile(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX);

View File

@ -110,6 +110,8 @@ namespace NSDoctRenderer
nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM;
else if (L"html" == sExt)
nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER;
else if (L"form" == sExt)
nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF;
return nFormat;
}
}
@ -619,7 +621,10 @@ namespace NSDoctRenderer
if (type & AVS_OFFICESTUDIO_FILE_DOCUMENT)
{
sEmptyPath = sEmptyPath + L"new.docx";
if (type == AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF)
sEmptyPath = sEmptyPath + L"new.pdf";
else
sEmptyPath = sEmptyPath + L"new.docx";
m_nFileType = 0;
}
else if (type & AVS_OFFICESTUDIO_FILE_PRESENTATION)