| | |
| | | import com.ruoyi.common.enums.PhotoEnum; |
| | | import com.ruoyi.common.enums.RadioEnum; |
| | | import com.ruoyi.common.enums.VadioEnum; |
| | | import com.smartor.domain.HtmlContentVO; |
| | | import org.apache.poi.hwpf.HWPFDocument; |
| | | import org.apache.poi.hwpf.converter.PicturesManager; |
| | | import org.apache.poi.hwpf.converter.WordToHtmlConverter; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/htmlContent") |
| | | public AjaxResult htmlContent(@RequestBody HtmlContentVO htmlContentVO) { |
| | | // 获取文件的原始名称 |
| | | String fileName = htmlContentVO.getFileName(); |
| | | // 将文件保存到指定目录 |
| | | File outputFile = new File(RuoYiConfig.getUploadPath() + "/show/" + fileName.split("\\.", 2)[0] + "/" + fileName); |
| | | try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"))) { |
| | | writer.write(htmlContentVO.getContent()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String url = serverConfig.getUrl() + "/profile/upload/show/" + fileName.split("\\.", 2)[0] + "/" + fileName; |
| | | return AjaxResult.success(url); |
| | | } |
| | | |
| | | |
| | | public static void convertDocToHtml(String docFilePath, String outputHtmlFilePath) throws TransformerException, IOException, ParserConfigurationException { |
| | | |
| | | InputStream inputStream = new FileInputStream(docFilePath); |