I export Mathematica tables to Excel every day, for sharing reports with non-Mathematica users. It exports the values without flaw, but ignores any formatting. Consider the following:
colHeadings = {"datum 1", "datum 2"};
rowHeadings = {"yesterday", "today", "tomorrow"};
data = {{1.2, 2.4}, {1.3, 2.1}, {1.31, 2.0}};
dataT = Prepend[Partition[Flatten[Transpose[{rowHeadings, data}]], 3],
Flatten[{"", colHeadings}]];
I would like to export this to Excel with a modest amount of formatting -- column borders would suffice. It's easy to format the data in Mathematica, some examples follow:
table1 = TableForm[dataT]
table2 = TableForm[data, TableHeadings -> {rowHeadings, colHeadings}]
grid1 = Grid[dataT, Alignment -> {{Right, {Decimal}}},
Dividers -> {All, {True, True, {False}, True}}]
But no matter which of these I export to Excel, it comes out the same, as a raw data table.
Export[FileNameJoin[{$HomeDirectory, "Desktop", "dataT.xlsx"}], dataT]
Export[FileNameJoin[{$HomeDirectory, "Desktop",
"table1.xlsx"}], table1]
Export[FileNameJoin[{$HomeDirectory, "Desktop",
"table2.xlsx"}], table2] (* omits the column and row headings *)
Export[FileNameJoin[{$HomeDirectory, "Desktop", "grid1.xlsx"}], grid1]
Any suggestions, or am I asking for something that Mathematica just can't do?
Attachments: