The CSS styling of Confluence content is stripped when exporting to Word

Greetings StackOverflow community,

I have embarked on creating a document generator within Confluence 6.10.2 (utilizing JQuery 1.7.2) that offers a range of options for the user.

Users are able to interact with checkboxes or radio buttons that trigger the hiding/displaying of other pages integrated through HTML.

Once the desired documents/options are selected, users can then export them to Word.

The primary issue I am encountering is that the Export To Word feature in Confluence exports everything, including the generator and all sections that are normally hidden based on user choices...

To address this challenge, I have developed a popup that specifically includes only the elements selected by the user and integrated an "Export To Word" button which leverages jquery.wordexport.js as an additional library.

The secondary problem arises from the CSS styling not being passed along (currently marked as //TODO in that js file). Since I rely on CSS counter-reset/counter-increment for accurate header increments, the absence of CSS transmission disrupts this functionality.

I have attempted manually embedding the entire jquery.wordexport.js export script in my HTML and hard coding the CSS style, but unfortunately, none of these efforts proved successful.

<script src="https://www.jqueryscript.net/demo/Export-Html-To-Word-Document-With-Images-Using-jQuery-Word-Export-Plugin/FileSaver.js"></script>
<script src="https://www.jqueryscript.net/demo/Export-Html-To-Word-Document-With-Images-Using-jQuery-Word-Export-Plugin/jquery.wordexport.js"></script>

...
    // Launch popup
    $("button#submit").click(function(){
        var htmlContent = $( "#schedMaster" ).html();
        $( "#schedulesDiv" ).html(htmlContent);
        $( "#schedulesDiv" ).find(".noprint").remove();
        //$( "#schedulesDiv table, #schedulesDiv td" ).css("border", "1px solid black");
        $( "#schedulePopup" ).show();
    });

    $("button#exportWord").click(function(event){
        $("#schedulesDiv").wordExport();
    });

});
</script>

<div id="schedulesOverlay" style="display: none;" tabindex="0" class="aui-blanket"></div>
<div style="margin-top: -265px; margin-left: -433px; width: 1065px; height: 530px; z-index: 3004; display: none;" id="schedulePopup" class="aui-popup aui-dialog">
    <h2 class="dialog-title">Schedules</h2>
    <div class="dialog-page-body">
        <div style="height: 413px; padding: 20px;" class="dialog-panel-body">
            <div id="schedulesDiv">...</div>
        </div>
        <div class="dialog-button-panel">
            <button id="exportWord">Export to Word</button> <button id="close">Close</button>
        </div>
    </div>
</div>

NOTE: Interestingly, even after removing FileSaver.js and jquery.wordexport.js, the Export to Word function still generates a file... I am puzzled by this behavior and suspect it may be related to Atlassian's implementation of JQuery lacking similar functionality?

Thank you in advance for your assistance.

Answer №1

It has been discovered that pseudo elements like ::before are unable to be transferred when exporting to Word.

As a workaround, I am rewriting the headings with alpha/numerical values using the method described in this response: , before proceeding with the Word export.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Personalizing a class specifically for error messages within the jQuery Validation plugin

When using the jQuery Validate plugin, is it possible to set a separate class for the error message element without affecting the input element's class? ...

Utilizing jQuery autocomplete in an onKeyup event handler

Looking for a way to display the results of a jQuery function. As the user types in the search field, a function is triggered which retrieves data from the database. I can view the retrieved data using an alert function. <input type="text" n ...

Issues with CSS overlays arise when attempting to display a welcome page on top of a flash component

Can anyone help with fixing the issue of my overlay being hidden behind the flash element? The blue bar with the 'Continue' button still shows up on top. I need some CSS changes to make sure that the overlay appears above everything else below it ...

Tips for inserting HTML-tagged data into a database using AJAX and PHP

var id=$("#id").val(); var status=$("#status").val(); var jtitle=$("#jtitle").val(); function submitData(){ var id=$("#id").val(); var status=$("#status").val(); var jtitle=$("#jtitle").val(); var jdesc=tinyMCE.acti ...

Issue with clearTimeout function not functioning properly on keyup event in iFrame

While there may be many similar questions out there, I have yet to find a solution that works for me. Currently, I am developing a WYSIWYG editor and I want it to save when the user performs a keyup action. However, I do not want it to update after every ...

How to lineup social media icons across on a Tumblr blog

I managed to successfully integrate the like and tweet buttons into my blog, but I'm struggling with aligning them horizontally after each post. My goal is to position the tweet button just to the left of the facebook like button for a cleaner layout. ...

How to duplicate an array in Twig using Symfony 2

What is the best way to duplicate a form array created with the Symfony 2 form builder at the twig level? Below is an example of a form group that generates a complex form: {{ form_row(form.products.ItemOptions) }} I'm looking to copy the form arr ...

Tips for showcasing an image prior to uploading within a personalized design input file

I am facing an issue with displaying multiple images inside custom style input file labels before uploading them to the database. Currently, the script I am using only displays one image at a time and in random positions. My goal is to have each image ap ...

What are the best techniques for distinguishing the selected selector in jQuery?

$('#select_id1, #select_id2, #select_id3').change(function() { // Depending on which select element has changed, 'str' should be set accordingly. // For '#select_id1', 'str' should be equal to 'select_id ...

Customizing skin CSS for DNN Portal and Page images

Currently, I have a unique custom skin that I personally created. It is implemented on multiple portals that I am responsible for managing. My goal is to incorporate the ability for the header image to change based on the specific page being viewed. The he ...

Using AngularJS with the Chosen Plugin to pre-select a value in a dropdown menu

After following the guidance from this URL, I successfully incorporated the chosen plugin into Angular.js. Now that I can retrieve the value, my next objective is to have the selected value be pre-selected in the chosen dropdown menu. If anyone has a sim ...

Fade in elements as the cursor moves, without hovering over a specific element

I'm working on implementing a fade-in effect for content when the mouse moves (similar to Google's homepage), but I'd like to avoid this behavior if the cursor is hovering over a specific div. Here are the basics: $("html").hover(function( ...

HTML and CSS link conflict

As a beginner in CSS, I am experimenting with creating a simple website using HTML and CSS. However, I have encountered an issue where the links on the left side of my page are being interfered with by a paragraph in the middle section. This causes some of ...

What is the process for adjusting the color of the browser tab?

My chat application is running smoothly, but a client has requested the ability to highlight or make the browser tab blink when they receive a visitor call. This will help them respond promptly to incoming inquiries. Does anyone know how to implement thi ...

Trouble with sending data from $.ajax to my demo.php file

I'm having an issue with sending data to the demo.php file using my code. This is the code I am working with: <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script> function update(str) { var str2=s ...

Tips for handling numerous buttons in ionic?

I'm currently working on an app that includes surveys. In this app, users are required to answer by selecting either the Yes or No button. The desired behavior is for the chosen button to turn blue once clicked, while the other button should maintain ...

Utilizing jQuery grep() to sort through a JSON array

Despite my attempts to find a suitable example on this platform, I am still struggling to adapt them to my specific needs. Essentially, all I require is to filter some JSON results using the grep() function. Here is the JSON data that I am working with: ...

The div is lacking in height

I have 3 divs that belong to the stackContainer class: .stackContainer { position: relative; } Within these divs, I want multiple elements stacked on top of each other. To achieve this, I use the following code: .stackItem { position: absolute; ...

Full comprehension with a width of 100%

Here is an example where .flex2 has 2 children. 1st child - width: 300px 2nd child - width: 100% .b{ height: 50px; } .flex2{ margin-top: 20px; display: flex; .box{ background-color: blue; width: 300px; } .box1{ backgroun ...

IE11 experiencing issues with font loading

I need help troubleshooting why the fonts are not loading properly in the body section of my articles, specifically when viewed in Internet Explorer. Take a look at an example article here: I am fetching from this CSS file: , and I have included the nece ...