diff --git a/demos/dev.css b/demos/dev.css
index d6cef21..6c593e3 100644
--- a/demos/dev.css
+++ b/demos/dev.css
@@ -19,7 +19,7 @@ td {
}
.grandecellule {
- font-size: 1.4rem;
+ font-size: 1.4rem;
}
@@ -29,7 +29,6 @@ td {
cell.Header {
font-style: italic;
- background-color: #2244aa;
}
cell.Grande ~ .essai {
@@ -40,10 +39,25 @@ cell.Grande ~ .essai {
cell.EncorePlusGrande ~ .grandecellule {
font-size: 18pt;
+ background-color: #ddd;
}
+cell.Heritage + cell.Bold {
+ padding: 0.3cm;
+ border: 0.75pt solid #333;
+}
+
+
column.Longue ~ .longuecolonne {
- width: 7cm;
+ width: 12cm;
+}
+
+column.Moyenne ~ .moyennecolonne {
+ width: 8cm;
+}
+
+column.Courte {
+ width: 4cm;
}
row.Entete {
diff --git a/demos/dev.html b/demos/dev.html
index 6670389..4c05478 100644
--- a/demos/dev.html
+++ b/demos/dev.html
@@ -14,12 +14,13 @@
+
@@ -44,9 +45,9 @@ function fodsContent() {
data-od-fixed-columns="1">
-
+
-
+
@@ -70,18 +71,17 @@ function fodsContent() {
Caché dans OD
Test à des lignes vides
- Cellule 1.4 |
+ Cellule 1.4 |
- Cellule 2.1 (Très grande) |
+ Cellule 2.1 (Très grande) |
Cellule 2.3 |
-160 |
- Cellule 3.1 |
- Cellule 3.2 |
- 1000 € |
+ Cellule 3.1 |
+ 1100 € |
-$2500 |
diff --git a/src/js/Html2Ods.js b/src/js/Html2Ods.js
new file mode 100644
index 0000000..6967832
--- /dev/null
+++ b/src/js/Html2Ods.js
@@ -0,0 +1,12 @@
+/* global OpenDocument */
+
+var Html2Ods = {};
+
+
+Html2Ods.blob = function (table, options) {
+ return OpenDocument.OdsConverter.convertToBlob(table, options);
+};
+
+Html2Ods.xml = function (table, options) {
+ return OpenDocument.OdsConverter.convertToXml(table, options);
+};
diff --git a/src/js/opendocument/OpenDocument.OdsConverter.js b/src/js/opendocument/OpenDocument.OdsConverter.js
index 8788e2c..6191102 100644
--- a/src/js/opendocument/OpenDocument.OdsConverter.js
+++ b/src/js/opendocument/OpenDocument.OdsConverter.js
@@ -123,7 +123,11 @@ OpenDocument.OdsConverter.prototype.convert = function (table, options) {
}
function _getCellText(cellElement) {
- let cellText = cellElement.dataset[textDataAttribute];
+ let cellText = cellElement.dataset["odText"];
+ if (cellText) {
+ return cellText;
+ }
+ cellText = cellElement.dataset[textDataAttribute];
if (cellText) {
return cellText;
}
@@ -281,7 +285,7 @@ OpenDocument.OdsConverter.readTableColumns = function(table, styleManager) {
let columnName = OpenDocument.COLUMNSTYLE_PREFIX + columnNumber;
columnNumber++;
let columnStyle = new OpenDocument.Style("column", columnName);
- let originalStyleName = col.dataset["odStyle"];
+ let originalStyleName = _getColumnStyleName(col);
if (originalStyleName) {
let originalStyle = styleManager.getStyle("column-named", originalStyleName);
if (originalStyle) {
@@ -296,6 +300,20 @@ OpenDocument.OdsConverter.readTableColumns = function(table, styleManager) {
result.push(new OpenDocument.Elements.TableColumn(columnName, col.span, "Standard"));
}
return result;
+
+
+ function _getColumnStyleName(col) {
+ let styleName = col.dataset["odStyle"];;
+ if (styleName) {
+ return styleName;
+ }
+ styleName = styleManager.getMatchingStyleName("column", col);
+ if (styleName) {
+ return styleName;
+ }
+ return "";
+ }
+
};
diff --git a/src/js/opendocument/OpenDocument.StyleManager.js b/src/js/opendocument/OpenDocument.StyleManager.js
index 4eaf001..0623a19 100644
--- a/src/js/opendocument/OpenDocument.StyleManager.js
+++ b/src/js/opendocument/OpenDocument.StyleManager.js
@@ -302,10 +302,11 @@ OpenDocument.StyleManager.readStyleSheet = function (styleManager, styleSheet) {
}
function _parseClass(classToken) {
- if (!classToken.startsWith('.')) {
+ let dotIndex = classToken.indexOf('.');
+ if (dotIndex === -1) {
return false;
}
- return classToken.substring(1);
+ return classToken.substring(dotIndex + 1);
}
};