seeking guidance on Word Addin

Robert Rodini 11 Reputation points
2022-01-10T23:28:31.417+00:00

I am seeking guidance from experts like you. I would like to automate (via a Word Addin using JavaScript) a repetitive task regarding sample ballot production. The process would go like this:

  1. Take a ,txt file as input. The text file has ballot information
  2. Process the .txt file into Word "components" w/ named fields
  3. Build a .docx file with proper formatting applied to the component fields

To make this more concrete here's an example.

1) Text file content looks like this:
163736-sample-input.png
2) The desired "component" would look like this:
Office title: Justice of the Supreme Court
Office instructions: Vote for ONE
Candidate name 1: Maria McLaughlin
Candidate party 1: Democratic
Candidate name 2: Kevin Brobson
Candidate party 2: Republican
3) The docx file content would look like this:
163719-sample-output.png

Is there anything like a "component" in Word? (e.g. word part, group component?).

Thanks
Bob

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
867 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,488 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Robert Rodini 11 Reputation points
    2022-01-14T18:06:37.44+00:00

    I figured this out. Rather than expecting some from an Office library to do this I can do this myself. How? by isolating the text for a ballot office (in this case "Justice of the Supreme Court" and then processing the text using regular expressions.

    Hope this helps someone in the future.

    1 person found this answer helpful.
    0 comments No comments