# Export Table with URL as HTML?

This is expression:

exp=Grid[{{Hyperlink@"http://www.wolfram.com", "this is first line"},
Frame -> All]


I want to export it to HTML.

Export["test.html",exp] doesn't help and it throws error.

So I define a notebook, this is my first to to use Notebook programming, and I don't how to reproduce the same result as the above image.

notebook = Notebook[{
Cell@RowBox[{ButtonBox[RowBox[{"http://www.wolfram.com"}],
ButtonData -> {"http://www.wolfram.com", None}],
"this is first line"}],
Cell@RowBox[{ButtonBox[RowBox[{"http://mathematica.stackexchange.com"}],
ButtonData -> {"http://mathematica.stackexchange.com", None}],
"this is second line"}]
}];
NotebookPut[notebook]


But when exporting, it changes.

Export["test", notebook, "HTML"]


These are just the first couple of errors. It goes on like that. On the other hand, ExportString[exp, "HTMLFragment"] seems to work. A solution could then be to do something like this:
html = ExportString[exp, "HTMLFragment"]
FileNameJoin[{$TemporaryDirectory, "grid.html"}], StringJoin["<html><body>", html, "</body></html>"], "Text" ]  This will export the table to an HTML file and open it in a browser, and the table looks the way you would expect it to look. It would be good to report the problem to WRI. This looks like something that they would like to fix. • Thank you! But this is a little problem when using ExportString, ExportString["木", "HTMLFragment"] will throws error. If all character are English, it works fine. – partida Jun 2 '18 at 14:16 • @partida Well, this is another problem. If you look at the stack trace then you will see that Export uses BinaryWrite to write the file. The documentation for BinaryWrite explicitly says that all characters must have a character code between 0 and 255. I think you should point this out to WRI, along with the original problem, so that they can both fix the recursion errors and make it possible to use international characters. (I so not rule out that there is a workaround, but I don't know any.) – C. E. Jun 2 '18 at 14:35 • OK, I will send this to wolfram , and , i will add it to the question if have more information.Thanks anyway – partida Jun 2 '18 at 14:44 This works as expected in version 9 (Windows 10 64bit): Export["test.html", Notebook[{Cell[BoxData[ToBoxes[exp]], "Output"]}], "HTML"]  How the exported file looks in Chrome: • it throws error again. Version: MMA 11.3.0 Linux – partida Jun 2 '18 at 14:01 • Also bazillions of $RecursionLimit::reclim2 errors on MMA 11.3., macOS. – Henrik Schumacher Jun 2 '18 at 15:57