Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

EDIT: István Zachar informed me of the Rasterize[] command, which does exactly what I need. Danke!

I have a self-built function that uses Grid[] to create a table that is more presentation-friendly than TableForm. Example output is:

Example output of dougTable

What I usually do to copy this into a presentation is take a screenshot with the Snipping Tool. For plots, I can just select the plot in Mathematica and then select Edit -> Copy As -> Bitmap. I want to be able to do the same with this table. Right now, if I try selecting the table, I get a cursor and can start typing in the figure.

I was hoping there was a Mathematica function that just puts a selectable bounding box around the entire output of a function, but I've been unable to find one yet. Does anyone have any ideas on how to make this entire table selectable?

Source code for my function can be found below, although you shouldn't need to use it to find a solution to the problem: any function with a non-graphic default output should work fine.

Clear[dougTable]
dougTable[data_List, cols_List: {}, rows_List: {}] :=
 Module[
  {genOpts, none, colHead, rowHead, both, font},
  genOpts = {Frame -> All, Background -> RGBColor[1, .9, 0], 
    FrameStyle -> Thickness[1]};
  font = {FontFamily -> "Arial", FontSize -> 12, FontWeight -> "Bold"};
  none = {genOpts, 
    Dividers -> {{1 -> Thickness[2], -1 -> Thickness[2]}, {1 -> 
        Thickness[2], -1 -> Thickness[2]}}};
  both = {genOpts, 
    Dividers -> {{1 -> Thickness[2], -1 -> Thickness[2], 
       2 -> Thickness[2]}, {1 -> Thickness[2], -1 -> Thickness[2], 
       2 -> Thickness[2]}}, 
    ItemStyle -> {{Directive[font], Automatic}, {Directive[font], 
       Automatic}}};
  colHead = {genOpts, 
    Dividers -> {{1 -> Thickness[2], -1 -> Thickness[2]}, {1 -> 
        Thickness[2], -1 -> Thickness[2], 2 -> Thickness[2]}}, 
    ItemStyle -> {Automatic, {Directive[font], Automatic}}};
  rowHead = {genOpts, 
    Dividers -> {{1 -> Thickness[2], -1 -> Thickness[2], 
       2 -> Thickness[2]}, {1 -> Thickness[2], -1 -> Thickness[2]}}, 
    ItemStyle -> {{Directive[font], Automatic}, Automatic}};

  Which[Length[cols] == 0 && Length[rows] == 0, Grid[data, none],
   Length[cols] != 0 && Length[rows] == 0, 
   Grid[Prepend[data, cols], colHead],
   Length[cols] == 0 && Length[rows] != 0, 
   Grid[MapThread[Prepend[#1, #2] &, {data, rows}], rowHead],
   Length[cols] != 0 && Length[rows] != 0, 
   Grid[Prepend[MapThread[Prepend[#1, #2] &, {data, rows}], cols], 
    both]]
  ]
share|improve this question

1 Answer 1

up vote 6 down vote accepted

If you select your output cell (by the bracket on the right), it can be converted to bitmap via the Cell $\rightarrow$ Convert To $\rightarrow$ Bitmap menu option. For programmatic conversion:

If you prefer bitmaps, you can rasterize your table:

table = TableForm[{{5, 7}, {4, 2}, {10, 3}},
    TableHeadings -> {{"A", "B", "C"}, {"1", "2"}}];

Rasterize@table

Mathematica graphics

If you want to keep the structure of your copied object, use Graphics or GraphicsGrid (though both require the manual setup of an appropriate ImageSize):

{GraphicsGrid[{{table}}, ImageSize -> 100], Graphics[Inset@table, ImageSize -> 100]}

Mathematica graphics

share|improve this answer
    
The Rasterize[] function is what I was looking for! Thanks. –  dthor Oct 26 '12 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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