Git Product home page Git Product logo

Comments (4)

jondo89 avatar jondo89 commented on June 28, 2024
if( fvis ) {
                var new_footer = thtml.find(options.footerarea)[0].outerHTML;
                thtml.find(options.footerarea).replaceWith('');
                thtml.find('table#' + options.headerfooterid + ' .f').append( 
                        GG.footerstart() + new_footer + GG.footerend());

                thtml.find('#'+options.headerfooterid+'').append('Adding random text here fixes this issue') 
                html = thtml[0].outerHTML;
            }

As shown above, fixes the problem, but really not sure what the root of this issue really is, it has something to do with the

var thtml = $(html);

which somehow modifies the HTML text using jquery, this then fails within word doc.

Above my pay grade!

from googoose.

jondo89 avatar jondo89 commented on June 28, 2024
  GG.convert_hdrftr = function( html ) {
            if( options.debug )
                GG.debug_fn('GG.convert_hdrftr');
            var hvis = options.headerarea && $(options.headerarea).length;
            var fvis = options.footerarea && $(options.footerarea).length;
            if( hvis || fvis ) {
                var thtml = $('<div>' + html + '</div>' );
                var hdrftr = $('<div id=\'' + options.headerfooterid + '\'></div>');
                hdrftr.append('<div><div class=headerArea></div><div class=footerArea></div></div>');
                thtml.append(hdrftr);
                html = thtml[0].outerHTML;

                html = GG.convert_totalpage(html);
                html = GG.convert_currentpage(html);
            }

            var thtml = $(html);
            if( hvis ) {
                var new_header = thtml.find(options.headerarea)[0].outerHTML;
                thtml.find(options.headerarea).replaceWith('');
                thtml.find('#' + options.headerfooterid + ' .h').append( 
                        GG.headerstart() + new_header + GG.headerend() );
                html = thtml[0].outerHTML;
            }
            if( fvis ) {
                var new_footer = thtml.find(options.footerarea)[0].outerHTML;
                thtml.find(options.footerarea).replaceWith('');
                thtml.find('#' + options.headerfooterid + ' .f').append( 
                        GG.footerstart() + new_footer + GG.footerend());
                html = thtml[0].outerHTML;
            }
            return html;

        }

Rather than appending random text, changing the header and footers to divs rather than tables has worked to fix the square question mark icon issue in ms word.

from googoose.

MohammedHyderAli avatar MohammedHyderAli commented on June 28, 2024
  GG.convert_hdrftr = function( html ) {
            if( options.debug )
                GG.debug_fn('GG.convert_hdrftr');
            var hvis = options.headerarea && $(options.headerarea).length;
            var fvis = options.footerarea && $(options.footerarea).length;
            if( hvis || fvis ) {
                var thtml = $('<div>' + html + '</div>' );
                var hdrftr = $('<div id=\'' + options.headerfooterid + '\'></div>');
                hdrftr.append('<div><div class=headerArea></div><div class=footerArea></div></div>');
                thtml.append(hdrftr);
                html = thtml[0].outerHTML;

                html = GG.convert_totalpage(html);
                html = GG.convert_currentpage(html);
            }

            var thtml = $(html);
            if( hvis ) {
                var new_header = thtml.find(options.headerarea)[0].outerHTML;
                thtml.find(options.headerarea).replaceWith('');
                thtml.find('#' + options.headerfooterid + ' .h').append( 
                        GG.headerstart() + new_header + GG.headerend() );
                html = thtml[0].outerHTML;
            }
            if( fvis ) {
                var new_footer = thtml.find(options.footerarea)[0].outerHTML;
                thtml.find(options.footerarea).replaceWith('');
                thtml.find('#' + options.headerfooterid + ' .f').append( 
                        GG.footerstart() + new_footer + GG.footerend());
                html = thtml[0].outerHTML;
            }
            return html;

        }

Rather than appending random text, changing the header and footers to divs rather than tables has worked to fix the square question mark icon issue in ms word.

Yes @jondo89, it is working fine with your fix.
but one typo, we need to replace headerArea and footerArea class with h and f respectively to work perfectly

from googoose.

aadel112 avatar aadel112 commented on June 28, 2024

Thanks for the discussion. I've been gone from this project for a long time, but I'm going to try to actually maintain it now. I've merged your changes.

05c8824

from googoose.

Related Issues (17)

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.