Using Content Select to insert formatted text blocks

Home Forums Open-Xml-PowerTools Using Content Select to insert formatted text blocks

This topic contains 3 replies, has 2 voices, and was last updated by  Eric White 7 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3609

    Entropy
    Participant

    Hi, I am using DocumentAssembler successfully to create docx documents, but I have one slight issue; I build my XML in SQL code and one field contains comment text that often includes linefeeds and bulleted lists.
    For example the following has been pasted straight out of SQL:

    Notes:

    • Our quotation has been prepared from copies of: (list drawings used in tender)

    • We exclude vapour control layers, damp-proof membranes and insulation, which may be required to render the system fully waterproof. Bailey cladding constitutes a ‘rainscreen’ product and is not 100% water resistant as a component used in isolation.

    • We have amended the profiles slightly to suit standard Bailey systems, without compromising the overall design intent.

    but after being converted into XML and dropped into the word doc it looks like this;

    Notes: • Our quotation has been prepared from copies of: (list drawings used in tender) • We exclude vapour control layers, damp-proof membranes and insulation, which may be required to render the system fully waterproof. Bailey cladding constitutes a ‘rainscreen’ product and is not 100% water resistant as a component used in isolation. • We have amended the profiles slightly to suit standard Bailey systems, without compromising the overall design intent.

    The XML lloks like this;

    <?xml version=”1.0″ encoding=”windows-1252″
    ?>
    <Quote xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
    <QuoteHead>
    <Company>BAIL001</Company>
    <QuoteNum>10009</QuoteNum>
    <CustNum>4</CustNum>
    <EntryDate>2016-08-02</EntryDate>
    <QuoteComment>
    Notes:

    • Our quotation has been prepared from copies of: (list drawings used in tender)

    • We exclude vapour control layers, damp-proof membranes and insulation, which may be required to render the system fully waterproof. Bailey cladding constitutes a ‘rainscreen’ product and is not 100% water resistant as a component used in isolation.

    • We have amended the profiles slightly to suit standard Bailey systems, without compromising the overall design intent.

    </QuoteComment>
    <DueDate>2016-08-05</DueDate>
    <DateQuoted xsi:nil=”true”/>
    <ExpirationDate xsi:nil=”true”/>
    <FollowUpDate xsi:nil=”true”/>

    How can I preserve or restore the line feed, carriage returns and other formatting in the word doc? Do I need to specify a stylesheet to the XML?

    Regards Mark

    #3641

    Eric White
    Keymaster

    Hi Mark,

    This is a very interesting scenario. I didn’t specifically think of this scenario when I designed DocumentAssembler.

    One idea that I’ve had cooking for some time is to enable importing XHtml content. In this approach, you would convert your text to equivalent XHtml (or an approximation thereof), and DocumentAssembler would use the HtmlToWmlConverter module to convert to DOCX. Then, separately, I would enable the use of DocumentBuilder to import that new DOCX into the generated document.

    This isn’t a huge amount of work – a few days at most. However, this is not currently in my schedule. (I am doing some super-cool Open XML work currently, and will be blogging about it soon.)

    One approach you might take – when you see this content, insert some special tags in the document, and then post-process the document, making it as you like.

    I’ve put this on my list of projects.

    -Eric

    #3655

    Entropy
    Participant

    Hi Eric,

    Thanks for the update. That is very exciting news, would that mean that any docx could also be imported into the document?
    For the time being I am de-constructing the text block in SQL code into individual lines then re-building it in the document as a Repeat Select. It is not perfect but it works. Please let me know when you are likely to start work on this feature.

    Regards Mark

    #3674

    Eric White
    Keymaster

    Hi Mark,

    Yes, indeed, importing a document into another document is a simpler case of importing HTML, and this would also be a feature of the new DocumentAssembler.

    The great thing is that because this new code would rely on existing Open-Xml-PowerTools code, it would not be a huge effort to write. I designed the system with this idea in mind.

    As with all such efforts, creating XUnit tests, and productizing the code requires just as much (or more) time than actually writing the code.

    I hope to tackle this functionality in the next 2-3 months, but we’ll see how my schedule works out.

    Regards, Eric

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.