4
$\begingroup$

I want to use ExportString to generate HTML expression. Here is an easy example:

ExportString[x^3, "HTML", "FullDocument" -> False]

gives

<p class="Output">
<img src="HTMLFiles/m-937b9f3a-d110-4ad9-b508-e9c5f1c8dc0f_1.gif" alt="m-937b9f3a-d110-4ad9-b508-e9c5f1c8dc0f_1.gif" width="14" height="16" style="vertical-align:middle" />
</p>

I cannot find the folder HTMLFiles and related file gif. I tried setting the working directory, or looking in any folder of the computer, without having success. My guess is that files are not actually generated. But the point is: ExportString is not useful at all for HTML format. Please, help, any comment is welcome.


Finally I get the answer: it's the temporary folder kept by $TemporaryDirectory.

It was very hard to discover it because the folder HTMLFiles is istantaneously removed after the images are generated. In order to discover it, I created the folder HTMLFiles in my $TempDirectory and then changed the folder's permission so it was not possible to delete it. Doing so I had the confirmation that this is the position where ExportString creates the temporary images.

Now, the question is another one: if I want to use ExportString to get an HTML convertion of a notebook so to embed it into some other html code, how I can avoid that images are destroyed? In other words, if I have to convert a whole notebook (with many plots and expressions in TraditionalForm) by program (not by hand), and for other reasons I need ExportString and not Export, how to resolve the images issue?

$\endgroup$
  • $\begingroup$ I converted your self-answer to an edit because it primarily introduces a new question. I hope this will help you get the answer you seek. $\endgroup$ – Mr.Wizard Apr 15 '15 at 15:35
  • $\begingroup$ @Mr.Wizard: thanks for that, surely it helps making the thread more clear. $\endgroup$ – bobknight Apr 15 '15 at 18:58
2
$\begingroup$

I searched my entire system for that folder and couldn't find it. Of course there is always Export that can put the files at a location of our choosing, I'm not sure what the downside is:

Export["~/Desktop/", x^3, "HTML", "FullDocument" -> False]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.