Merging word document to spira report

Monday, August 30, 2021
Avatar

I need to append/merge the cover page in docx format to the exported spira report.

kindly let me know if anyone has tried to achieve the same or has any idea on merging to spira report.

 

Thanks 

3 Replies
Tuesday, August 31, 2021
Avatar
re: shosamath Monday, August 30, 2021

Try to write your own custom report where docx is formed by JavaScript. We are preparing complicated office docs that way as xslt is not so flexible as JS.

Tuesday, August 31, 2021
Avatar
re: ilyapolyakov Tuesday, August 31, 2021
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:template match="/RESULTS">
        <script type="text/javascript">
            releases=[];
            <xsl:for-each select="ROW">
                releases.push({
                id:xsltToNumber('<xsl:value-of select='ID'/>'),
                is_summary:xsltToBoolean('<xsl:value-of select='IS_SUMMARY'/>'),
                name:xsltToString('<xsl:value-of disable-output-escaping="yes" select='Name'/>'),
                resource_count:xsltToNumber('<xsl:value-of select='RESOURCE_COUNT'/>'),
                uihd:xsltToNumber('<xsl:value-of select='UIhd'/>'),
                apihd:xsltToNumber('<xsl:value-of select='APIhd'/>'),
                });
            </xsl:for-each>
            <xsl:text disable-output-escaping="yes">
            <![CDATA[
console.log('it works'); // any JS code here that works for example with releases array variable that is defined above
            ]]>
            </xsl:text>
        </script>
    </xsl:template>
</xsl:stylesheet>

Here is an example.

First part: we are combining XSLT+JS to fill JS variable.

Second part: we are working with full JS power to get anything we need incl. word document to download.

Thursday, September 2, 2021
Avatar
re: ilyapolyakov Tuesday, August 31, 2021

We are doing basically the same but without the Javascript. 

Purely based on XSLT, you can dynamically add the word formatting for almost any feature supported by Word (although stuff like signature boxes takes some extra tweaking to get right)

 

Statistics
  • Started: Monday, August 30, 2021
  • Last Reply: Thursday, September 2, 2021
  • Replies: 3
  • Views: 112