Git Product home page Git Product logo

docxbox's People

Contributors

kstenschke avatar lucasbornhauser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docxbox's Issues

fields in header and footer can't be replaced

Describe the bug
Trying to replace a merge field which is located either in the footer or the header with a string doesn't work. No error message is given.

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox sfv mergefields.docx "MERGEFIELD Mergefield_Header" FooBar
  2. Resources: mergefields.docx

Expected behavior
The provided field is replaced by the given string

Environment:

  • docxBox Version: 0.0.5

remove unused methods

ccpcheck reports:

[src/docxbox/helper/helper_image.cc:9]: (style) The function 'GetDimension' is never used.
[src/docxbox/helper/helper_string.cc:102]: (style) The function 'GetSubStrAfter' is never used.
[src/docxbox/helper/helper_string.cc:28]: (style) The function 'GetSubStrCount' is never used.
[src/vendor/tinyxml2/tinyxml2.cpp:1979]: (style) The function 'InsertNewChildElement' is never used.
[src/vendor/tinyxml2/tinyxml2.cpp:1985]: (style) The function 'InsertNewComment' is never used.
[src/vendor/tinyxml2/tinyxml2.cpp:1997]: (style) The function 'InsertNewDeclaration' is never used.
[src/vendor/tinyxml2/tinyxml2.cpp:1991]: (style) The function 'InsertNewText' is never used.
[src/vendor/tinyxml2/tinyxml2.cpp:2003]: (style) The function 'InsertNewUnknown' is never used.
[src/docxbox/helper/helper_file.cc:6]: (style) The function 'IsFile' is never used.
[src/docxbox/helper/helper_string.cc:123]: (style) The function 'IsNumeric' is never used.
[src/docxbox/helper/helper_string.cc:60]: (style) The function 'ReplaceAll' is never used.
[src/docxbox/helper/helper_string.cc:38]: (style) The function 'ReplaceFirstOccurrence' is never used.
[src/docxbox/helper/helper_string.cc:155]: (style) The function 'ToLower' is never used.
[src/docxbox/helper/helper_string.cc:163]: (style) The function 'ToUpper' is never used.
[src/docxbox/helper/helper_string.cc:168]: (style) The function 'UcFirst' is never used.

error in "mm" command

Describe the bug
Trying to change the meta attribute "subject" throws an error:
"terminate called after throwing an instance of 'char const*'"

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox mm file.docx subject "replacementString"
  2. Resources: any valid docx file containing the meta attribute "subject"

Expected behavior
Meta attribute gets changed

Environment:

  • docxBox Version: 0.0.5

Error when setting meta attribute "created" or "modified"

Describe the bug
Setting the meta attribute "created" resets "modified" and vice versa

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox mm bio_assay.docx created "2020-10-11T15:02:22Z"
  2. Resources: bio_assay.docx

Expected behavior
Given meta attribute gets changed without changing the other attribute

Environment:

  • docxBox Version: 0.0.5

Possible std::bad_alloc during rpt

TODO(kay): fix possible crash during rpt:
docxbox rpt foo.docx "22.02.2016" "11.01.2020"
=> terminate called after throwing an instance of 'std::bad_alloc'

Functional tests allover return code is inconclusive

Describe the missing feature
test.sh does not return any conclusive status code: its return code always signals successful execution, independent of the results of the individual test suites.

TODO
When any single one (or more) of the invoked test suites does return a code different to 0 (= success), test.sh should finally conclude with a return signal 1 (= general error).

command "lsl" throws an error

Describe the bug
When running
"./docxbox lsl filename.docx {missing search string}"
or
"./docxbox lsl {missing filename}"
an error is thrown:
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'

To Reproduce
Steps to reproduce the behavior:

  1. Command :
  • ./docxbox lsl table_unordered_list_images.docx

OR

  • ./docxbox lsl
  1. Resources: table_unordered_list_images.docx

Expected behavior
An error message stating that a required argument is missing respectively
An error message stating that a required file is missing

Environment:

  • docxBox Version: 0.0.4

command to list fiels is displayed wrong in help

Describe the bug
The command to list fields in a docx is: ./docxbox lsd filename.docx, but the output of "./docxbox h " is: {see screenshot} lsg <--> lsd

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox h

Expected behavior
correct output of commands

Screenshots
Auswahl_046

Environment:

  • docxBox Version: 0.0.1

error in "lslj" command

Describe the bug
When running
"./docxbox lsl filename.docx -j searchString"
or
"./docxbox lsl filename.docx --json searchString"
an error is thrown:
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'

To Reproduce
Steps to reproduce the behavior:

  1. Command:
  • ./docxbox lsl bio_assay.docx -j fonts
  • ./docxbox lsl bio_assay.docx --json fonts
  1. Resources: valid .docx file

Expected behavior
List of files containing given search string as JSON

Environment:

  • docxBox Version: 0.0.4

Replacing string with table corrupts DOCX

Describe the bug
Replacing a string with a table makes DOCX invalid

To Reproduce
Steps to reproduce the behavior:

  1. Command:
  • docxbox rpt table_unordered_list_images.docx Officia "{"table":{"header":["A","B","C"],"content":[["a1","a2","a3"],["b1","b2","b3"],["c1","c2","c3"]]}}"
  1. Resources: table_unordered_list_images.docx

Expected behavior

  • Given string is replaced by table (works)
  • DOCX is valid →DOCX is invalid

Screenshots
Auswahl_059

word_errormessage

Environment:

  • docxBox Version: 0.0.5
  • DOCX Processor: Word 2019

Additional information
Screenshot only shows relevant lines, the actual diff has more lines

error when setting field values with "sfv" command

Describe the bug
Setting filed values by using "sfv" breaks and throws an error:
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid.
A directory with the unziped files is created in the project root

To Reproduce
Steps to reproduce the behavior:

  1. Command:
  • ./docxbox sfv test/files/docx/file_with_mergefields.docx "MERGEFIELD Schueler_Anrede" TEST
  1. Resources:
  • file_with_mergefields.docx

Expected behavior
Setting new value to given field.

Screenshots
Auswahl_051

Environment:

  • docxBox Version: 0.0.4

command "lorem" replaces file

Describe the bug
When trying to replace text in a file by dummy text and saving it to a new file, the old file is replaced by the new one.

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox lorem docx_v1 new_docx.docx
  2. Resources: valid docx file

Expected behavior
Text gets replaced and is saved in new file

Environment:

  • docxBox Version: 0.0.4

Multiple errors when setting meta attributes

Describe the bug
Setting or changing meta attributes throw errors:

  • description:
    docxBox Error - iled render opening tag. Unknown attribute:
    docxBox Error - iled render opening tag. Unknown attribute:
    docxBox Error - iled render closing tag. Unknown attribute:
    docxBox Error - Update/Insert meta attribute failed.

  • Application, AppVersion, Company, xmlSchema, Template:
    docxBox Error - Invalid argument: Unknown or unsupported attribute: {Meta-Attribute}
    docxBox Error - Initialization for meta modification failed.

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox mm bio_assay.docx {Meta-Attribute} "Replacement"
  2. Resources: bio_assay.docx

Expected behavior
Provided Meta-Attribute is set/changed

Environment:

  • docxBox Version: 0.0.5

error when runnnig longhand command of lslj

Describe the bug
When running the longhand command of lslj (--lj) all files are listed (not just those containing given search string) and are not in JSON-Format

To Reproduce

  1. Command: ./docxbox ls filename.docx --lj "searchString"
  2. Resources: any valid .docx file

Expected behavior
A list of files containing given search string as JSON

Screenshots
Expected Output:
Auswahl_053

Actual Output:
Auswahl_052

Environment:

  • docxBox Version: 0.0.4

setting meta attribute via batch processing does not work

Describe the bug
Trying to set a meta attribute through batch processing throws an error:
docxBox Error - Invalid argument: Unknown or unsupported attribute: "title"
docxBox Error - Initialization for meta modification failed.

To Reproduce
Steps to reproduce the behavior:

  1. Command:
  • ./docxbox batch table_unordered_list_images.docx "{"1":{"mm":["title","foo"]}}"
  1. Resources: table_unordered_list_images.docx

Expected behavior
Meta attribute gets set, batch processing continues

Environment:

  • docxBox Version: 0.0.5

incomplete "lsd" command

Describe the bug
When listing fields with the "lsd" command fields in the footer are not listed.

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox lsd mergefields.docx
  2. Resources: mergefields.docx

Expected behavior
Command lists all fields in docx

Screenshots
Auswahl_062

Auswahl_063

Environment:

  • docxBox Version: 0.0.5

command "lorem" doesn't replace text and throws an error

Describe the bug
When trying to randomize text in a docx file by running "docxbox lorem .docx" an error is thrown:

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid

To Reproduce
Steps to reproduce the behavior:

  1. Command: docxbox lorem
  2. Resources: any valid docx

Expected behavior
Text in provided docx file gets replaced by random text

Environment:

  • docxBox Version: 0.0.4

command "lslj" does not work

Describe the bug
The "./docxbox h lslj" or any other "lslj" command don't work.
The Output is: "Unknown command: lslj."

To Reproduce

  1. Command: "./docxbox h lslj"

Expected behavior
Help displayed for lslj command

Environment:

  • docxBox Version: 0.0.4

Feature: Add valgrind memory-leak test

  • allow test.sh to receive optional argument: "valgrind"
  • when running in valgrind mode: add bats-preparation for executing test-suite w/ valgrind: copy functional-suites, replace doxbox binary-path within all copied suites prefixed w/ valgrind execution
  • test leak detection and reporting: provoke leakage, ensure correct error-message and return-signal

"ls wrong-file-type" throws an error

Describe the bug
When trying to list files in a none .docx file docxbox throws an error:

terminate called after throwing an instance of 'std::runtime_error'
what(): bad zip

To Reproduce
Steps to reproduce the behavior:

  1. Command: docxbox ls wrong_file_type
  2. Resources: any none .docx file

Expected behavior
An error message stating a wrong file type was provided.

Environment:

  • docxBox Version: 0.0.4

command "rmt" removes too much

Describe the bug
When running the "rem" command more than the expected strings are removed.

To Reproduce

  1. Command: "./docxbox rem test/files/docx/cp_table_unordered_list_images.docx Dolore incididunt
  2. Resources: copy of table_unordered_list_images.docx

Expected behavior
All strings in between and including given strings are removed from given .docx

Screenshots
Original docx:
Auswahl_048

Manipulated docx:
Auswahl_047

Environment:

  • docxBox Version: 0.0.2

use word2016 can not open bio_assay.docx in test file

Describe the bug
replace text using markup text, then the docx file can not be open by word2016

To Reproduce
Steps to reproduce the behavior:

  1. Command ' ./docxbox rpt /mnt/hgfs/vmware-share/docxbox-master/docxbox-master/test/files/docx/mergefields.docx sunt "{"h1":{"text":"Foo"}}" '

Environment:

  • docxBox Version:newest
  • DOCX Processor, if involved (Microsoft Word or other application)

Replacing a string with a heading is not working

Describe the bug
When trying to replace a given string by a heading docxBox throws an error:

docxBox Error - DOCX creation failed

To Reproduce
Steps to reproduce the behavior:

  1. Command: doxbox rpt table_unordered_list_images.docx "searchString" "{\"h1":{\"text\":\"Foo\"}}"
  2. Resources: table_unordered_list_images.docx

Expected behavior
The given string gets replaced by the given heading

Environment:

  • docxBox Version: 0.0.5

"uz -i" and "uz --indent" dont indent XML files

Describe the bug
When using the longhand option of the uzi command (uz -i or uz --indent) the XML files are not indented.
Additionally, there is a spelling error when displaying help (ident instead of indent)

To Reproduce

  1. Command:
  • docxbox uz file.docx -i
  • docxbox uz file.docx --indent
  1. Resources: any valid docx file

Expected behavior
XML files get indented

Screenshots
Auswahl_054

Environment:

  • docxBox Version: 0.0.4

Replacing an image without providing a replacement image creates a folder in project root

Describe the bug
Trying to replace an image omitting the image- name and path to be replaced, a folder containing the files of the given .docx named like the .docx file is created in the project root.
An error message is given, stating a file name of the replacement image is missing.

To Reproduce
Command:

  • $ ./bin/linux/docxbox rpi test/files/table_unordered_list_images.docx image1.jpeg

Files:

  • table_unordered_list_images.docx

Expected behavior
An error message.

Environment:

  • docxBox Version: 0.0.1

"rpt" doesn't replace text

Describe the bug
When trying to replace a string by another string, it doesn't get replaced and the process isn't terminated. No error is shown.

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox rpt valid_docx Lorem xxx
  2. Resources: any valid docx file

Expected behavior
All occurrences of given string are replaced

Environment:

  • docxBox Version: 0.0.4

refine error message of rpi command without a docx file

Describe the bug
The error message of the rpi command without providing a docx file is misleading.
Error message now: "Missing argument: Filename of image to be replaced"
Expected Error message: "Missing argument: Filename of DOCX to be extracted"

To Reproduce

  1. Command './docxbox rpi '

Expected behavior
An error message stating the docx file is missing. The correct message was provided, but possibly got lost.

Environment:

  • 0.0.1

rpt ol renders ul instead

Describe the bug
rpt w/ ordered-list renders an unordered list instead.

Additional information
Speculation: abstractNumId of numbering.xml and document.xml might point to the wrong markup.

Optional out-filename not recognized during cmd command

TODO(kay): optional out-filename not recognized during cmd command:

docxbox cmd foo.docx "nano DOCX/word/document.xml" foo2.docx

=> Hit [Enter] when done.
mv: missing destination file operand after 'tmp.zip'
Try 'mv --help' for more information.

functional tests linting issues

Please see issues within the ShellCheck report of functional tests.

  • see: ShellCheck
  • note 1: The unrecognized shebang line of bats we might have to mark for being ignored by ShellCheck
  • note 2: I disabled ShellCheck linting within Travis CI config for now / until these issues are fixed - please use ShellCheck locally (at least) for the time being

Zipping files requires installed zip

Technical Debt
ATM zipping extracted files into a DOCX invokes (and requires having installed) the zip application instead of using MinizCpp (as the unzip operations do). The existing method for zipping via MinizCpp creates a DOCX which MS Word notifies as being corrupt (other word processors accept it).

command "rpi" doesn't replace image

Describe the bug
When trying to replace an image in a docx an error is thrown:
File not found: cp_table_unordered_list_images.docx-1589441700/word/media/image1.jpeg
The doesn't get replaced.

To Reproduce
Steps to reproduce the behavior:

  1. Command:
  • docxbox rpi validDocxWithImage image1.jpeg test/files/images/2100x400.jpeg
  1. Resources:
  • table_unordered_list_images.docx
  • 2100x400.jpeg

Expected behavior
The image gets replaced

Environment:

  • docxBox Version: 0.0.4

consistency: rename "rem" to "rmt"

For consistency of naming (existing and future) commands, "rem" command should be named "rmt".
The naming will than correspond to "replace text" being abbreviated "rpt", and will keep sibling commands consistent and deductable and easier rememberable (e.g. "remove between fields": "rmf").

Replacing text with an image throws error

Describe the bug
Replacing text with an image throws an error when using EMU's:

  • terminate called after throwing an instance of 'nlohmann::detail::type_error'
    what(): [json.exception.type_error.302] type must be string, but is number
    Abgebrochen

To Reproduce
Steps to reproduce the behavior:

  1. Command: ./docxbox rpt table_unordered_list_images.docx "{"image":{"size":[2438400,1828800]}}" test/files/images/2100x400.jpeg
  2. Resources:
  • table_unordered_list_images.docx
  • 2100x400.jpeg

Expected behavior
The provided text gets replaced by the given image

Environment:

  • docxBox Version: 0.0.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.