I have an excel workbook that I am trying to export to an HTML format (vba script which is called from Powershell below). When I run it on my local machine (Win10, Office 2016) the formatting is perfectly fine. However, when I try to run the same script from the server where it is supposed to live (WS2012, Office 2016) the formatting is ruined (except, oddly in Internet Explorer on certain machines).
I cannot figure out why the initiating computer is causing a problem with formatting for only this one section.
Original in Excel:
Working:
Not working:
So there's something between running on my local machine and on the server, the server had been on O'2013 but even after trying O'2016 it still doesn't work. I also disabled macro security in case that was screwing something up (it was disabled on my local) which didn't help either.
The excel file and the vba should be fine since it does work normally.
Macro to export HTML:
With ActiveWorkbook.PublishObjects.Add(xlSourceWorkbook, _
"C:\Tasks\Phonebook-HTML\Web\Index.htm", , , xlHtmlStatic, _
"TELEPHONEBOOK_18991", "")
.Publish (True)
.AutoRepublish = False
End With
Working HTML:
<tr height="59" style="mso-height-source:userset;height:44.45pt">
<td height="59" class="xl154" style="height:44.45pt"><a href="sheet007.html#RANGE!A2"><span style="color:#0070C0;font-size:16.0pt;
font-weight:700">A</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A27"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">B</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A94"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">C</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A157"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">D</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A215"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">E</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A227"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">F</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A247"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">G</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A281"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">H</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A328"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">I</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A334"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">J</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A354"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">K</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A391"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">L</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A422"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">M</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A503"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">N</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A517"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">O</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A534"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">P</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A585"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Q</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A587"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">R</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A634"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">S</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A695"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">T</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A718"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">U</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A719"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">V</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A741"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">W</span></a></td>
<td class="xl154"><a href=""><span style="color:#0070C0;font-size:16.0pt;
font-weight:700">X</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A767"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Y</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A771"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Z</span></a></td>
</tr>
NOT Working HTML:
<tr height="59" style="mso-height-source:userset;height:44.45pt">
<td height="59" class="xl154" style="height:44.45pt"><a href="sheet007.html#RANGE!A2"><span style="color:#0070C0;font-size:16.0pt;
font-weight:700">A</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A27"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">B</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A94"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">C</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A157"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">D</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A215"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">E</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A227"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">F</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A247"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">G</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A281"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">H</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A328"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">I</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A334"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">J</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A354"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">K</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A391"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">L</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A422"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">M</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A503"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">N</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A517"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">O</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A534"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">P</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A585"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Q</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A587"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">R</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A634"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">S</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A695"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">T</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A718"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">U</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A719"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">V</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A741"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">W</span></a></td>
<td class="xl154"><a href=""><span style="color:#0070C0;font-size:16.0pt;
font-weight:700">X</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A767"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Y</span></a></td>
<td class="xl154"><a href="sheet007.html#RANGE!A771"><span style="color:#0070C0;
font-size:16.0pt;font-weight:700">Z</span></a></td>
</tr>