-->

GWT:导出CellTable图像或PDF文件(GWT: Export a CellTable to

2019-10-17 05:19发布

我出了在一个GFlot SimplePlot绘制数据CellTable。

情节的出口是可能的GFlots集成功能:

    exportImage = plot.getImage();

现在,我想导出CellTable也显示相应的数据的情节。 这可能在客户端某种方式与GWT? 它不必是CellTable本身,只是它显示就足够的数据。

Answer 1:

我认为,你可以使用flash4j库:

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);
}
}

你可以看到更详细的信息链接



文章来源: GWT: Export a CellTable to an image or pdf file