Add text/plan, open office and xls transformation support.
This commit is contained in:
@@ -88,6 +88,38 @@ public class MindmapController extends BaseController {
|
||||
return new ModelAndView("transformViewFreemind", values);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"text/plain"}, params = {"download=txt"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsText(@PathVariable int id) throws IOException {
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
values.put("content", mindMap.getXmlStr());
|
||||
values.put("filename", mindMap.getTitle());
|
||||
return new ModelAndView("transformViewTxt", values);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.ms-excel"}, params = {"download=xls"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException {
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
values.put("content", mindMap.getXmlStr());
|
||||
values.put("filename", mindMap.getTitle());
|
||||
return new ModelAndView("transformViewXls", values);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.oasis.opendocument.text"}, params = {"download=odt"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsOdt(@PathVariable int id) throws IOException {
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
values.put("content", mindMap.getXmlStr());
|
||||
values.put("filename", mindMap.getTitle());
|
||||
return new ModelAndView("transformViewOdt", values);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json", "text/html", "application/xml"})
|
||||
public ModelAndView retrieveList(@RequestParam(required = false) String q) throws IOException {
|
||||
final User user = Utils.getUser();
|
||||
|
||||
@@ -86,6 +86,9 @@ public class TransformView extends AbstractView {
|
||||
final Object mindmap = viewMap.get("mindmap");
|
||||
final StreamResult result = new StreamResult(outputStream);
|
||||
jaxbMarshaller.marshal(mindmap, result);
|
||||
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER) {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
factory.export(properties, content, outputStream, null);
|
||||
} else {
|
||||
factory.export(properties, null, outputStream, content);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user