diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index 0767bb6..f401ed1 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -3,6 +3,17 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
 
 ---------- version 1.1.7 ----------
 
+[w2x] Export suffix and prefix on footnotes and endnotes
+
+[w2x] Export footnotes as endnotes (if text:footnotes-position="document"). A new option footnotes_heading is added:
+  The value of this (if non-empty) is used as heading for the footnotes in this case
+
+[w2x] EPUB: Set body margin to zero
+
+[w2x] Export footnote rule (using first master page)
+
+[w2x] Export page background color (using first master page)
+
 [w2x] The option use_dublin_core no longer has effect on EPUB export (instead identifier, author, date and title are always
   exported, and other properties are exported if they exist and are non-empty)
 
diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt
index 64ca00d..97baaf2 100644
Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ
diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
index b460916..8efea47 100644
--- a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
+++ b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java
@@ -16,11 +16,11 @@
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
-*  Copyright: 2002-2010 by Henrik Just
+*  Copyright: 2002-2011 by Henrik Just
 *
 *  All Rights Reserved.
 * 
-*  Version 1.2 (2010-12-09)
+*  Version 1.2 (2011-03-08)
 *
 */ 
 
@@ -407,11 +407,13 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
     	@Override protected void setControls(DialogAccess dlg) {
     		listBoxFromConfig(dlg, "Formulas", "formulas", sFormulaValues, (short) 0);
     		textFieldFromConfig(dlg, "EndnotesHeading", "endnotes_heading");
+    		textFieldFromConfig(dlg, "FootnotesHeading", "footnotes_heading");
     	}
     	
     	@Override protected void getControls(DialogAccess dlg) {
     		listBoxToConfig(dlg, "Formulas", "formulas", sFormulaValues);
     		textFieldToConfig(dlg, "EndnotesHeading", "endnotes_heading");
+    		textFieldToConfig(dlg, "FootnotesHeading", "footnotes_heading");
     	}
     	
     	@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
diff --git a/source/java/writer2latex/office/XMLString.java b/source/java/writer2latex/office/XMLString.java
index 0cb8a64..942d52a 100644
--- a/source/java/writer2latex/office/XMLString.java
+++ b/source/java/writer2latex/office/XMLString.java
@@ -16,11 +16,11 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *  Copyright: 2002-2010 by Henrik Just
+ *  Copyright: 2002-2011 by Henrik Just
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2010-12-15)
+ *  Version 1.2 (2011-03-08)
  *
  */
 
@@ -355,6 +355,7 @@ public class XMLString {
     public static final String TEXT_REFERENCE_FORMAT="text:reference-format";
     public static final String TEXT_REF_NAME="text:ref-name";
     public static final String TEXT_FORMULA="text:formula";
+    public static final String TEXT_FOOTNOTES_POSITION="text:footnotes-position";
     public static final String TEXT_NOTE_CLASS="text:note-class";
     public static final String TEXT_CITATION_BODY_STYLE_NAME="text:citation-body-style-name";
     public static final String TEXT_CITATION_STYLE_NAME="text:citation-style-name";
diff --git a/source/java/writer2latex/xhtml/Converter.java b/source/java/writer2latex/xhtml/Converter.java
index 7249c6a..f38381a 100644
--- a/source/java/writer2latex/xhtml/Converter.java
+++ b/source/java/writer2latex/xhtml/Converter.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2011-02-21)
+ *  Version 1.2 (2011-03-08)
  *
  */
 
@@ -237,10 +237,6 @@ public class Converter extends ConverterBase {
         else if (ofr.isPresentation()) { drawCv.convertDrawContent(body); }
         else { textCv.convertTextContent(body); }
 		
-        // Add footnotes and endnotes
-        textCv.insertFootnotes(htmlDoc.getContentNode());
-        textCv.insertEndnotes(htmlDoc.getContentNode());
-        
         // Set the title page and text page entries
         if (converterResult.getContent().isEmpty()) {
         	// No headings in the document: There is no title page and the text page is the first page
@@ -555,7 +551,6 @@ public class Converter extends ConverterBase {
 	
     // Prepare next output file
     public Element nextOutFile() {
-        if (nOutFileIndex>=0) { textCv.insertFootnotes(htmlDoc.getContentNode()); }
         htmlDoc = new XhtmlDocument(getOutFileName(++nOutFileIndex,false),nType);
         htmlDoc.setConfig(config);
         if (template!=null) { htmlDoc.readFromTemplate(template); }
@@ -574,10 +569,10 @@ public class Converter extends ConverterBase {
              ". See http://writer2latex.sourceforge.net for more info."),
              rootElement.getFirstChild());
 		
-        // Apply page formatting (using first master page)
-        if (ofr.getFirstMasterPage()!=null && !ofr.isPresentation()) {
+        // Apply default writing direction
+        if (!ofr.isPresentation()) {
             StyleInfo pageInfo = new StyleInfo();
-            styleCv.getPageSc().applyStyle(ofr.getFirstMasterPage().getName(),pageInfo);
+            styleCv.getPageSc().applyDefaultWritingDirection(pageInfo);
             styleCv.getPageSc().applyStyle(pageInfo,htmlDoc.getContentNode());
         }
 
diff --git a/source/java/writer2latex/xhtml/PageStyleConverter.java b/source/java/writer2latex/xhtml/PageStyleConverter.java
index 57e3ea4..8f2da30 100644
--- a/source/java/writer2latex/xhtml/PageStyleConverter.java
+++ b/source/java/writer2latex/xhtml/PageStyleConverter.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2010-03-01)
+ *  Version 1.2 (2010-03-08)
  *
  */
 
@@ -41,12 +41,15 @@ import writer2latex.util.CSVList;
  * A page style in a presentation is represented through the master page,
  * which links to a page layout defining the geometry and optionally a drawing
  * page defining the drawing background.
- * In a presentation document we export the full page style, in a text
- * document we only export the background.
+ * 
+ * In a presentation document we export the full page style.
+ * In a text document we export the writing direction, background color and footnote rule for the first master page only
  */
 public class PageStyleConverter extends StyleConverterHelper {
+	
+	private boolean bHasFootnoteRules = false;
 
-    /** Create a new <code>PageStyleConverter</code>
+	/** Create a new <code>PageStyleConverter</code>
      *  @param ofr an <code>OfficeReader</code> to read style information from
      *  @param config the configuration to use
      *  @param converter the main <code>Converter</code> class
@@ -54,27 +57,45 @@ public class PageStyleConverter extends StyleConverterHelper {
      */
     public PageStyleConverter(OfficeReader ofr, XhtmlConfig config, Converter converter, int nType) {
         super(ofr,config,converter,nType);
+        this.bConvertStyles = config.xhtmlFormatting()==XhtmlConfig.CONVERT_ALL || config.xhtmlFormatting()==XhtmlConfig.IGNORE_HARD;
+    }
+    
+    /** Apply footnote rule formatting (based on first master page)
+     * 
+     * @param info then StyleInfo to which style information should be attached
+     */
+    public void applyFootnoteRuleStyle(StyleInfo info) {
+    	bHasFootnoteRules = true;
+    	info.sClass="footnoterule";
+    }
+    
+    /** Apply default writing direction (based on first master page)
+     * 
+     * @param info then StyleInfo to which style information should be attached
+     */
+    public void applyDefaultWritingDirection(StyleInfo info) {
+        MasterPage masterPage = ofr.getFirstMasterPage();
+        if (masterPage!=null) {
+            PageLayout pageLayout = ofr.getPageLayout(masterPage.getPageLayoutName());
+            if (pageLayout!=null) {
+                applyDirection(pageLayout,info);
+            }
+        }    	
     }
 
+    /** Apply a master page style - currently only for presentations
+     * 
+     * @param sStyleName The name of the master page
+     * @param info the StyleInfo to which style information should be attached
+     */
     public void applyStyle(String sStyleName, StyleInfo info) {
         MasterPage masterPage = ofr.getMasterPage(sStyleName);
-        String sDisplayName = masterPage.getDisplayName();
         if (masterPage!=null) {
+            String sDisplayName = masterPage.getDisplayName();
             if (ofr.isPresentation()) {
                 // Always generates class name
                 info.sClass="masterpage"+styleNames.getExportName(sDisplayName);
             }
-            else {
-                // For text documents only writing direction and background
-                String sPageLayout = masterPage.getPageLayoutName();
-                PageLayout pageLayout = ofr.getPageLayout(sPageLayout);
-                if (pageLayout!=null) {
-                    applyDirection(pageLayout,info);
-                    if (bConvertStyles) {
-                        getFrameSc().cssBackground(pageLayout,info.props,true);
-                    }
-                }
-            }
         }
     }
 
@@ -83,9 +104,10 @@ public class PageStyleConverter extends StyleConverterHelper {
      */
     public String getStyleDeclarations(String sIndent) {
         StringBuffer buf = new StringBuffer();
+
+        // This will be master pages for presentations only
         Enumeration<String> names = styleNames.keys();
         while (names.hasMoreElements()) {
-            // This will be master pages for presentations only
             String sDisplayName = names.nextElement();
             MasterPage style = (MasterPage)
                 getStyles().getStyleByDisplayName(sDisplayName);
@@ -102,12 +124,42 @@ public class PageStyleConverter extends StyleConverterHelper {
             if (drawingPage!=null) {
                 cssDrawBackground(drawingPage,info.props,true);
             }
-            // The export the results
+            // Then export the results
             buf.append(sIndent)
                .append(".masterpage").append(styleNames.getExportName(sDisplayName))
                .append(" {").append(info.props.toString()).append("}")
                .append(config.prettyPrint() ? "\n" : " ");
         }
+        
+        if (ofr.isText()) {
+        	// Export page formatting for first master page in text documents
+        	MasterPage masterPage = ofr.getFirstMasterPage();
+        	if (masterPage!=null) {
+        		PageLayout pageLayout = ofr.getPageLayout(masterPage.getPageLayoutName());
+        		if (pageLayout!=null) {
+        			if (bConvertStyles) {
+        				// Background color
+        				StyleInfo pageInfo = new StyleInfo();
+        				getFrameSc().cssBackground(pageLayout,pageInfo.props,true);
+        				if (converter.isOPS()) { // Use zero margin for EPUB and default margins for XHTML
+        					pageInfo.props.addValue("margin", "0");
+        				}
+        				if (pageInfo.hasAttributes()) {
+        					buf.append(sIndent).append("body {").append(pageInfo.props.toString()).append("}")
+        					.append(config.prettyPrint() ? "\n" : " ");
+        				}
+        				
+        				// Footnote rule
+        				if (bHasFootnoteRules) {
+        					StyleInfo ruleInfo = new StyleInfo();
+        					cssFootnoteRule(pageLayout,ruleInfo.props);
+        					buf.append(sIndent).append("hr.footnoterule {").append(ruleInfo.props.toString()).append("}")
+        					.append(config.prettyPrint() ? "\n" : " ");
+        				}
+        			}
+        		}
+        	}
+        }
         return buf.toString();
     }
 	
@@ -132,6 +184,39 @@ public class PageStyleConverter extends StyleConverterHelper {
         String sHeight = style.getProperty(XMLString.FO_PAGE_HEIGHT);
         if (sHeight!=null) { props.addValue("height",scale(sHeight)); }
     }
+    
+	// Footnote rule
+    private void cssFootnoteRule(PageLayout style, CSVList props) {
+    	String sBefore = style.getFootnoteProperty(XMLString.STYLE_DISTANCE_BEFORE_SEP);
+    	if (sBefore!=null) { props.addValue("margin-top",scale(sBefore)); }
+    	String sAfter = style.getFootnoteProperty(XMLString.STYLE_DISTANCE_AFTER_SEP);
+    	if (sAfter!=null) { props.addValue("margin-bottom", scale(sAfter)); }
+    	String sHeight = style.getFootnoteProperty(XMLString.STYLE_WIDTH);
+    	if (sHeight!=null) { props.addValue("height", scale(sHeight)); }
+    	String sWidth = style.getFootnoteProperty(XMLString.STYLE_REL_WIDTH);
+    	if (sWidth!=null) { props.addValue("width", sWidth); }
+    	
+    	String sColor = style.getFootnoteProperty(XMLString.STYLE_COLOR);
+    	if (sColor!=null) { // To get the expected result in all browsers we must set both
+    		props.addValue("color", sColor);
+    		props.addValue("background-color", sColor);
+    	}
+
+    	String sAdjustment = style.getFootnoteProperty(XMLString.STYLE_ADJUSTMENT);
+    	if ("right".equals(sAdjustment)) {
+    		props.addValue("margin-left", "auto");
+    		props.addValue("margin-right", "0");
+    	}
+    	else if ("center".equals(sAdjustment)) {
+    		props.addValue("margin-left", "auto");
+    		props.addValue("margin-right", "auto");
+    	}
+    	else { // default left
+    		props.addValue("margin-left", "0");
+    		props.addValue("margin-right", "auto");
+    	}
+    }
+
 
 	
 	
diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java
index 7bcd8f6..7badf9c 100644
--- a/source/java/writer2latex/xhtml/TextConverter.java
+++ b/source/java/writer2latex/xhtml/TextConverter.java
@@ -16,11 +16,11 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *  Copyright: 2002-2010 by Henrik Just
+ *  Copyright: 2002-2011 by Henrik Just
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2010-12-29)
+ *  Version 1.2 (2011-03-08)
  *
  */
 
@@ -127,6 +127,9 @@ public class TextConverter extends ConverterHelper {
     private String sFntCitStyle = null;
     private String sEntCitBodyStyle = null;
     private String sEntCitStyle = null;
+    
+    // Footnote position (can be page or document)
+    private boolean bFootnotesAtPage = true;
 
     // Gather the footnotes and endnotes
     private LinkedList<Node> footnotes = new LinkedList<Node>();
@@ -161,6 +164,7 @@ public class TextConverter extends ConverterHelper {
         if (notes!=null) {
             sFntCitBodyStyle = notes.getProperty(XMLString.TEXT_CITATION_BODY_STYLE_NAME);
             sFntCitStyle = notes.getProperty(XMLString.TEXT_CITATION_STYLE_NAME);
+            bFootnotesAtPage = !"document".equals(notes.getProperty(XMLString.TEXT_FOOTNOTES_POSITION));
         }
         notes = ofr.getEndnotesConfiguration();
         if (notes!=null) {
@@ -187,7 +191,11 @@ public class TextConverter extends ConverterHelper {
         }
 
         // Convert content
-        traverseBlockText(onode,hnode);
+        hnode = (Element)traverseBlockText(onode,hnode);
+        
+        // Add footnotes and endnotes
+        insertFootnotes(hnode,true);
+        insertEndnotes(hnode);
 
         // Generate all indexes
         int nIndexCount = indexes.size();
@@ -563,6 +571,7 @@ public class TextConverter extends ConverterHelper {
             // No objections, this is a level that causes splitting
         	nCharacterCount = 0;
         	bPendingPageBreak = false;
+            if (converter.getOutFileIndex()>=0) { insertFootnotes(node,false); }
             return converter.nextOutFile();
         }
         return node;
@@ -1685,22 +1694,37 @@ public class TextConverter extends ConverterHelper {
         footnotes.add(onode);
 	} 
 	
-    public void insertFootnotes(Node hnode) {
+    private void insertFootnotes(Node hnode, boolean bFinal) {
         int n = footnotes.size();
-        for (int i=0; i<n; i++) {
-            Node footnote = footnotes.get(i);
-            String sId = Misc.getAttribute(footnote,XMLString.TEXT_ID); 
-            Node citation = Misc.getChildByTagName(footnote,XMLString.TEXT_FOOTNOTE_CITATION);
-            if (citation==null) { // try oasis
-                citation = Misc.getChildByTagName(footnote,XMLString.TEXT_NOTE_CITATION);
-            }
-            Node body = Misc.getChildByTagName(footnote,XMLString.TEXT_FOOTNOTE_BODY);
-            if (body==null) { // try oasis
-                body = Misc.getChildByTagName(footnote,XMLString.TEXT_NOTE_BODY);
-            }
-            traverseNoteBody(sId,sFntCitStyle,citation,body,hnode);
+        
+        if (n>0 && bFootnotesAtPage) { // Add footnote rule
+        	Element rule = converter.createElement("hr");
+        	StyleInfo info = new StyleInfo();
+        	getPageSc().applyFootnoteRuleStyle(info);
+        	getPageSc().applyStyle(info, rule);
+        	hnode.appendChild(rule);
+        }
+        else if (bFinal && !bFootnotesAtPage) { // New page if required for footnotes as endnotes
+        	if (nSplit>0) { hnode = converter.nextOutFile(); }
+        	insertNoteHeading(hnode, config.getFootnotesHeading(), "footnotes");        	
+        }
+        
+        if (bFinal || bFootnotesAtPage) { // Insert the footnotes
+        	for (int i=0; i<n; i++) {
+        		Node footnote = footnotes.get(i);
+        		String sId = Misc.getAttribute(footnote,XMLString.TEXT_ID); 
+        		Node citation = Misc.getChildByTagName(footnote,XMLString.TEXT_FOOTNOTE_CITATION);
+        		if (citation==null) { // try oasis
+        			citation = Misc.getChildByTagName(footnote,XMLString.TEXT_NOTE_CITATION);
+        		}
+        		Node body = Misc.getChildByTagName(footnote,XMLString.TEXT_FOOTNOTE_BODY);
+        		if (body==null) { // try oasis
+        			body = Misc.getChildByTagName(footnote,XMLString.TEXT_NOTE_BODY);
+        		}
+        		traverseNoteBody(sId,sFntCitStyle,citation,body,hnode,ofr.getFootnotesConfiguration());
+        	}
+        	footnotes.clear();
         }
-        footnotes.clear();
     }
 
     /* Process an endnote */
@@ -1719,27 +1743,11 @@ public class TextConverter extends ConverterHelper {
         endnotes.add(onode);
 	} 
 
-    public void insertEndnotes(Node hnode) {
+    private void insertEndnotes(Node hnode) {
         int n = endnotes.size();
         if (n>0) {
         	if (nSplit>0) { hnode = converter.nextOutFile(); }
-        	
-        	String sHeading = config.getEndnotesHeading();
-        	if (sHeading.length()>0) {
-        		Element heading = converter.createElement("h1");
-        		hnode.appendChild(heading);
-        		heading.appendChild(converter.createTextNode(sHeading));
-
-        		// Add to external content.
-        		if (nSplit>0) {
-                	converter.addContentEntry(sHeading, 1, null);        			
-        		}
-        		else {
-        			//For single output file we need a target
-                    converter.addTarget(heading,"endnotes");                
-                	converter.addContentEntry(sHeading, 1, "endnotes");        			
-        		}
-        	}
+        	insertNoteHeading(hnode, config.getEndnotesHeading(), "endnotes");
         	for (int i=0; i<n; i++) {
         		Node endnote = endnotes.get(i);
         		String sId = Misc.getAttribute(endnote,XMLString.TEXT_ID); 
@@ -1751,15 +1759,33 @@ public class TextConverter extends ConverterHelper {
         		if (body==null) { // try oasis
         			body = Misc.getChildByTagName(endnote,XMLString.TEXT_NOTE_BODY);
         		}
-        		traverseNoteBody(sId,sEntCitStyle,citation,body,hnode);
+        		traverseNoteBody(sId,sEntCitStyle,citation,body,hnode,ofr.getEndnotesConfiguration());
         	}
         }
     }
+    
+    private void insertNoteHeading(Node hnode, String sHeading, String sTarget) {
+    	if (sHeading.length()>0) {
+    		Element heading = converter.createElement("h1");
+    		hnode.appendChild(heading);
+    		heading.appendChild(converter.createTextNode(sHeading));
+
+    		// Add to external content.
+    		if (nSplit>0) {
+            	converter.addContentEntry(sHeading, 1, null);        			
+    		}
+    		else {
+    			//For single output file we need a target
+                converter.addTarget(heading,sTarget);                
+            	converter.addContentEntry(sHeading, 1, sTarget);        			
+    		}
+    	}
+    }
 
 	/*
      * Process the contents of a footnote or endnote
      */
-    private void traverseNoteBody (String sId, String sCitStyle, Node citation,Node onode, Node hnode) {
+    private void traverseNoteBody (String sId, String sCitStyle, Node citation, Node onode, Node hnode, PropertySet noteConfig) {
         // Create the anchor/footnote symbol:
         // Create target and link
         Element link = converter.createLink("body"+sId);
@@ -1767,43 +1793,22 @@ public class TextConverter extends ConverterHelper {
         StyleInfo linkInfo = new StyleInfo();
         getTextSc().applyStyle(sCitStyle,linkInfo);
         applyStyle(linkInfo,link);
+        String sPrefix = noteConfig.getProperty(XMLString.STYLE_NUM_PREFIX);
+        if (sPrefix!=null) {
+        	link.appendChild(converter.createTextNode(sPrefix));
+        }
         traversePCDATA(citation,link);
-        // Add a space and save it for later insertion:
+        String sSuffix = noteConfig.getProperty(XMLString.STYLE_NUM_SUFFIX);
+        if (sSuffix!=null) {
+        	link.appendChild(converter.createTextNode(sSuffix));        	
+        }
+        // Add a space and save it for later insertion 
         Element span = converter.createElement("span");
         span.appendChild(link);
         span.appendChild(converter.createTextNode(" "));
         asapNode = span;
 		
         traverseBlockText(onode,hnode);
-
-        /*if (onode.hasChildNodes()) {
-            NodeList nList = onode.getChildNodes();
-            int len = nList.getLength();
-            
-            for (int i = 0; i < len; i++) {
-                Node child = nList.item(i);
-                
-                if (child.getNodeType() == Node.ELEMENT_NODE) {
-                    String nodeName = child.getNodeName();
-                    
-                    if (nodeName.equals(XMLString.TEXT_H)) {
-                        handleHeading(child,hnode);
-                    }
-
-                    if (nodeName.equals(XMLString.TEXT_P)) {
-                        handleParagraph(child,hnode);
-                    }
-                    
-                    if (nodeName.equals(XMLString.TEXT_ORDERED_LIST)) {
-                        handleOL(child,0,null,hnode);
-                    }
-                    
-                    if (nodeName.equals(XMLString.TEXT_UNORDERED_LIST)) {
-                        handleUL(child,0,null,hnode);
-                    }
-                }
-            }
-        }*/
     }
 
     private void handlePageNumber(Node onode, Node hnode) {
diff --git a/source/java/writer2latex/xhtml/XhtmlConfig.java b/source/java/writer2latex/xhtml/XhtmlConfig.java
index 633e75a..0841551 100644
--- a/source/java/writer2latex/xhtml/XhtmlConfig.java
+++ b/source/java/writer2latex/xhtml/XhtmlConfig.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2011-02-23)
+ *  Version 1.2 (2011-03-08)
  *
  */
 
@@ -41,7 +41,7 @@ import writer2latex.util.Misc;
 
 public class XhtmlConfig extends writer2latex.base.ConfigBase {
     // Implement configuration methods
-    protected int getOptionCount() { return 53; }
+    protected int getOptionCount() { return 54; }
     protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; }
 	
     // Override setOption: To be backwards compatible, we must accept options
@@ -117,25 +117,26 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
     private static final int TABSTOP_STYLE = 31;
     private static final int FORMULAS = 32;
     private static final int ENDNOTES_HEADING = 33;
-    private static final int EXTERNAL_TOC_DEPTH = 34;
-    private static final int INCLUDE_TOC = 35;
-    private static final int SPLIT_LEVEL = 36;
-    private static final int REPEAT_LEVELS = 37;
-    private static final int PAGE_BREAK_SPLIT = 38;
-    private static final int SPLIT_AFTER = 39;
-    private static final int CALC_SPLIT = 40;
-    private static final int DISPLAY_HIDDEN_SHEETS = 41;
-    private static final int DISPLAY_HIDDEN_ROWS_COLS = 42;
-    private static final int DISPLAY_FILTERED_ROWS_COLS = 43;
-    private static final int APPLY_PRINT_RANGES = 44;
-    private static final int USE_TITLE_AS_HEADING = 45;
-    private static final int USE_SHEET_NAMES_AS_HEADINGS = 46;
-    private static final int XSLT_PATH = 47;
-    private static final int SAVE_IMAGES_IN_SUBDIR = 48;
-    private static final int UPLINK = 49;
-    private static final int DIRECTORY_ICON = 50;
-    private static final int DOCUMENT_ICON = 51;
-    private static final int ZEN_HACK = 52; // temporary hack for ePub Zen Garden styles
+    private static final int FOOTNOTES_HEADING = 34;
+    private static final int EXTERNAL_TOC_DEPTH = 35;
+    private static final int INCLUDE_TOC = 36;
+    private static final int SPLIT_LEVEL = 37;
+    private static final int REPEAT_LEVELS = 38;
+    private static final int PAGE_BREAK_SPLIT = 39;
+    private static final int SPLIT_AFTER = 40;
+    private static final int CALC_SPLIT = 41;
+    private static final int DISPLAY_HIDDEN_SHEETS = 42;
+    private static final int DISPLAY_HIDDEN_ROWS_COLS = 43;
+    private static final int DISPLAY_FILTERED_ROWS_COLS = 44;
+    private static final int APPLY_PRINT_RANGES = 45;
+    private static final int USE_TITLE_AS_HEADING = 46;
+    private static final int USE_SHEET_NAMES_AS_HEADINGS = 47;
+    private static final int XSLT_PATH = 48;
+    private static final int SAVE_IMAGES_IN_SUBDIR = 49;
+    private static final int UPLINK = 50;
+    private static final int DIRECTORY_ICON = 51;
+    private static final int DOCUMENT_ICON = 52;
+    private static final int ZEN_HACK = 53; // temporary hack for ePub Zen Garden styles
 
     protected ComplexOption xheading = addComplexOption("heading-map");
     protected ComplexOption xpar = addComplexOption("paragraph-map");
@@ -187,6 +188,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
         options[FLOAT_OBJECTS] = new BooleanOption("float_objects","true");
         options[TABSTOP_STYLE] = new Option("tabstop_style","");
         options[ENDNOTES_HEADING] = new Option("endnotes_heading","");
+        options[FOOTNOTES_HEADING] = new Option("footnotes_heading","");
         options[FORMULAS] = new IntegerOption("formulas","image+starmath") {
         	@Override public void setString(String sValue) {
         		super.setString(sValue);
@@ -351,6 +353,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
     public boolean xhtmlFloatObjects() { return ((BooleanOption) options[FLOAT_OBJECTS]).getValue(); }
     public String getXhtmlTabstopStyle() { return options[TABSTOP_STYLE].getString(); }
     public String getEndnotesHeading() { return options[ENDNOTES_HEADING].getString(); }
+    public String getFootnotesHeading() { return options[FOOTNOTES_HEADING].getString(); }
     public int formulas() { return ((IntegerOption) options[FORMULAS]).getValue(); }
     public int externalTocDepth() { return ((IntegerOption) options[EXTERNAL_TOC_DEPTH]).getValue(); }
     public boolean includeToc() { return ((BooleanOption) options[INCLUDE_TOC]).getValue(); }
diff --git a/source/oxt/writer2xhtml/W2XDialogs2/Content.xdl b/source/oxt/writer2xhtml/W2XDialogs2/Content.xdl
index bf87ff0..13a8c81 100644
--- a/source/oxt/writer2xhtml/W2XDialogs2/Content.xdl
+++ b/source/oxt/writer2xhtml/W2XDialogs2/Content.xdl
@@ -4,7 +4,7 @@
  <dlg:bulletinboard>
   <dlg:text dlg:id="FormulasHeadingLabel" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="245" dlg:height="12" dlg:value="Formulas"/>
   <dlg:text dlg:id="FormulasLabel" dlg:tab-index="1" dlg:left="10" dlg:top="22" dlg:width="110" dlg:height="12" dlg:value="Include as"/>
-  <dlg:menulist dlg:id="Formulas" dlg:tab-index="2" dlg:left="130" dlg:top="20" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="4" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:Formulas">
+  <dlg:menulist dlg:id="Formulas" dlg:tab-index="2" dlg:left="130" dlg:top="20" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:Formulas" dlg:spin="true" dlg:linecount="4">
    <dlg:menupopup>
     <dlg:menuitem dlg:value="Image with StarMath code"/>
     <dlg:menuitem dlg:value="Image with LaTeX code"/>
@@ -12,8 +12,10 @@
     <dlg:menuitem dlg:value="LaTeX code"/>
    </dlg:menupopup>
   </dlg:menulist>
-  <dlg:text dlg:id="EndnotesCategoryHeadingLabel" dlg:tab-index="3" dlg:left="5" dlg:top="36" dlg:width="245" dlg:height="12" dlg:value="Endnotes"/>
-  <dlg:text dlg:id="EndnotesHeadingLabel" dlg:tab-index="4" dlg:left="10" dlg:top="50" dlg:width="110" dlg:height="12" dlg:value="Heading"/>
+  <dlg:text dlg:id="EndnotesHeadingLabel" dlg:tab-index="4" dlg:left="10" dlg:top="50" dlg:width="110" dlg:height="12" dlg:value="Endnotes heading"/>
   <dlg:textfield dlg:id="EndnotesHeading" dlg:tab-index="5" dlg:left="130" dlg:top="48" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:EndnotesHeading"/>
+  <dlg:text dlg:id="NotesHeadingsLabel" dlg:tab-index="3" dlg:left="5" dlg:top="36" dlg:width="245" dlg:height="12" dlg:value="Footnotes and endnotes"/>
+  <dlg:text dlg:id="FootnotesHeadingLabel" dlg:tab-index="6" dlg:left="10" dlg:top="64" dlg:width="110" dlg:height="12" dlg:value="Footnotes heading"/>
+  <dlg:textfield dlg:id="FootnotesHeading" dlg:tab-index="7" dlg:left="130" dlg:top="62" dlg:width="120" dlg:height="12" dlg:help-url="org.openoffice.da.writer2xhtml.oxt:FootnotesHeading"/>
  </dlg:bulletinboard>
 </dlg:window>
\ No newline at end of file
diff --git a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp
index 0f66a5c..d342332 100644
--- a/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp
+++ b/source/oxt/writer2xhtml/help/en/org.openoffice.da.writer2xhtml.oxt/Configuration/Content.xhp
@@ -37,11 +37,19 @@
 			</listitem>
 		</list>
 
-        <paragraph role="heading" level="2" xml-lang="en-US">Endnotes</paragraph>
+        <paragraph role="heading" level="2" xml-lang="en-US">Footnotes and endnotes</paragraph>
+
+        <bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:FootnotesHeading" id="bm_configfootnotesheading"/>
 
         <bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:EndnotesHeading" id="bm_configendnotesheading"/>
-        <paragraph role="heading" level="3" xml-lang="en-US">Heading</paragraph>
+        <paragraph role="heading" level="3" xml-lang="en-US">Endnote heading</paragraph>
         <paragraph role="paragraph" xml-lang="en-US">In %PRODUCTNAME Writer, endnotes cannot have a heading. If you want to add
         a heading for the endnotes in the exported document, enter the desired heading here.</paragraph>
+
+        <paragraph role="heading" level="3" xml-lang="en-US">Footnote heading</paragraph>
+        <paragraph role="paragraph" xml-lang="en-US">In %PRODUCTNAME Writer, footnotes (when used as endnotes) cannot have a heading.
+        If you want to add a heading for the footnotes in the exported document, enter the desired heading here.
+        This has no effect if footnotes are placed at the bottom of the page.</paragraph>
+
     </body>
 </helpdocument>
\ No newline at end of file