电脑卡住了正在编辑的Word没保存

      前些日子遇到了这个问题,用的wps文档正在编辑,但是电脑忽然卡住了,把文档啥的都退出去了,没有保存,有点急,但是在网上找到了解决办法。

首先: wps软件

备份与恢复开启

文件中有个temp文件,将其后缀改为doc.即可恢复。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编辑 Word 内容并将其保存为图片,可以使用 Apache POI 和 Apache Batik 库。Apache POI 可以用于读取和写入 Word 文档,而 Apache Batik 可以将 SVG 转换为图像。以下是一个简单的 Java 代码示例,可以将 Word 文档的内容保存为 PNG 图像: ``` import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.PNGTranscoder; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; public class WordToImageConverter { public static void main(String[] args) { try { // Load the Word document InputStream inputStream = new FileInputStream("document.docx"); XWPFDocument document = new XWPFDocument(inputStream); // Get the content of the document StringBuilder content = new StringBuilder(); for (XWPFParagraph paragraph : document.getParagraphs()) { for (XWPFRun run : paragraph.getRuns()) { content.append(run.getText(0)); } } // Convert the content to SVG String svgContent = "<svg xmlns='http://www.w3.org/2000/svg'>" + "<foreignObject width='100%' height='100%'>" + "<div xmlns='http://www.w3.org/1999/xhtml'>" + content.toString() + "</div>" + "</foreignObject>" + "</svg>"; // Convert the SVG to PNG PNGTranscoder transcoder = new PNGTranscoder(); TranscoderInput input = new TranscoderInput(new StringReader(svgContent)); OutputStream outputStream = new FileOutputStream(new File("document.png")); TranscoderOutput output = new TranscoderOutput(outputStream); transcoder.transcode(input, output); outputStream.flush(); outputStream.close(); // Close the document document.close(); System.out.println("Document converted to image successfully."); } catch (Exception e) { e.printStackTrace(); } } } ``` 请注意,此代码示例仅适用于将单个段落的内容保存为图像。如果 Word 文档中有多个段落,则需要相应地修改代码以处理它们。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值