Skip to content

Instantly share code, notes, and snippets.

View voidException's full-sized avatar

小神经 voidException

  • 北京大学
  • China BeiJing
View GitHub Profile
@Hunsu
Hunsu / gist:6cc469c8caee622477ea
Last active September 12, 2021 13:14
Add image to word using docx4j
public class AddingAnInlineImage {
/**
* As is usual, we create a package to contain the document.
* Then we create a file that contains the image we want to add to the document.
* In order to be able to do something with this image, we'll have to convert
* it to an array of bytes. Finally we add the image to the package
* and save the package.
*/
public static void main (String[] args) throws Exception {
WordprocessingMLPackage wordMLPackage =
@jesperronn
jesperronn / docx2md.md
Last active November 15, 2024 20:52 — forked from aembleton/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution