问题
I have a CellTable showing data that is plotted in a GFlot SimplePlot.
An export of the plot is possible with GFlots integrated function:
exportImage = plot.getImage();
Now I would like to export the CellTable too, to show the corresponding data to the plot. Is this possible in some way with GWT on the client-side? It needn't to be the CellTable itself, just the data it shows would suffice.
回答1:
I think You can use flash4j library:
package com.emitrom.flash4j.demo.client;
import com.emitrom.flash4j.clientio.client.ClientIO;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
public class ClientIOExample implements EntryPoint {
@Override
public void onModuleLoad() {
// initialize the ClientIO module
ClientIO.init();
Button b = new Button("Click Me");
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// create a PDF File
PDF pdf = new PDF();
pdf.addPage();
pdf.setTextStyle(new RGBColor(0x000000));
pdf.setFont(new CoreFont(), 10);
pdf.addText("");
ClientIO.saveFile(pdf.save(), "file.pdf");
}
});
RootPanel.get().add(b);
}
}
You can see more detailed information a link
来源:https://stackoverflow.com/questions/12334257/gwt-export-a-celltable-to-an-image-or-pdf-file