Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

Formatting p tags in convert from html to ms word

$
0
0

I'm trying to get two signatures to appear on each link such as this enter image description here

but every time I export the the project it then only appears one per a line. I'm not sure if I need to do new margins for the p tags or if the way I'm pulling them from the textarea is messing up with the formatting.

<textarea id="content" cols="60" rows="20">
            @for (int i = 0; i < signatures.Length; i++)
            {
                if((i % 2) == 0)
                {
                    <br />
                }
                    <p id="signature" style="display:inline-block; padding-right: 25px;">__________________________ <br />@signatures[i]</p>
            }
        </textarea>

tinymce.init({
            selector: '#content',
            plugins: [
                "advlist autolink lists link image charmap print preview anchor",
                "searchreplace visualblocks code fullscreen fullpage",
                "insertdatetime media table contextmenu paste"
            ],
            fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt",
            toolbar: " undo redo | styleselect | bold italic | " +
                "alignleft aligncenter alignright alignjustify | fontselect | fontsizeselect ",
            signatures: [
                { inline: '#signature' }
            ]
        });
        document.getElementById('convert').addEventListener('click', function (e) {
            e.preventDefault();
var contentDocument = tinymce.get('content').getDoc();

            var content = '<!DOCTYPE html>' + contentDocument.documentElement.outerHTML;            
            if (@size == 2) {
                var converted = htmlDocx.asBlob(content, { margins: { left: 2000, right: 2000, top: 5150 } });
            }
            else {
                var converted = htmlDocx.asBlob(content, { margins: { left: 2250, right: 2000, top: 6500 } });
            }

            saveAs(converted, 'test.docx');

Viewing all articles
Browse latest Browse all 138192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>