docx

how can I put a content in a mergefield in docx

血红的双手。 提交于 2019-12-01 19:53:31
I'm developing a web application with asp.net and I have a file called Template.docx that works like a template to generate other reports. Inside this Template.docx I have some MergeFields (Title, CustomerName, Content, Footer, etc) to replace for some dynamic content in C#. I would like to know, how can I put a content in a mergefield in docx ? I don't know if MergeFields is the right way to do this or if there is another way. If you can suggest me, I appreciate! PS: I have openxml referenced in my web application. Edits: private MemoryStream LoadFileIntoStream(string fileName) { MemoryStream

Printing an OOXML document without MS Word installed

大兔子大兔子 提交于 2019-12-01 19:18:58
Is there any way to print an OOXML document (.docx file) without having MS Word installed? It works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvious so I'm inclined to believe there isn't a way. Is this the case? EDIT: Devin's answer is basically what I understood to be the case. I should have mentioned that I'm using the .NET framework. So I wondered if there is perhaps a .NET library which would be able to be handle a docx file for printing? I see when adding a

PDF文件如何转成markdown格式

ε祈祈猫儿з 提交于 2019-12-01 19:07:09
百度上根据pdf转makrdown为关键字进行搜索,结果大多数是反过来的转换,即markdown文本转PDF格式。 但是PDF转markdown的解决方案很少。 正好我工作上有这个需求,所以自己实现了一个解决方案。 下图是一个用PDF XChange Editor打开的PDF文件,我想将其内容通过markdown格式导出。 (1) 首先将该PDF导出成word格式,后缀.docx (2) 使用typora获得该word文档的markdown源代码: 此时任务只完成了一半,因为typora这个工具转换成的markdown格式,如果原始的word文档里包含图片,这些图片以本地图片的形式存在于markdown里,那我如果直接将包含了这些本地图片的标签的markdown发布到简书,CSDN,开源中国,腾讯云,阿里云这些支持markdown的社区时,这些本地图片将无法显示。 因此我们必须找到一个高效的方法,将word里包含的本地图片先上传到网络上,再用生成的包含了图片网络url的markdown标签替换本地图片标签。 (3) 把word文件的后缀从.docx改成.zip, 解压后,在文件夹word的子文件夹media里能找到所有的本地文件。 把这些本地文件全部上传到网站,生成下面这些url: 我写了一个工具

Printing an OOXML document without MS Word installed

妖精的绣舞 提交于 2019-12-01 18:01:52
问题 Is there any way to print an OOXML document (.docx file) without having MS Word installed? It works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvious so I'm inclined to believe there isn't a way. Is this the case? EDIT: Devin's answer is basically what I understood to be the case. I should have mentioned that I'm using the .NET framework. So I wondered if there is

Embed Google docs editor into webpage? [closed]

狂风中的少年 提交于 2019-12-01 17:50:53
Is it possible to embed the Google Docs editor so that it reads a file, which is then uploaded to a server (not google docs server) and you can edit it and save back to same file? I don't think this is currently possible with Google Docs . Yes it is: < iframe height="300" src="https://docs.google.com/spreadsheet/ccc?key=0AgRoqAerkV0-dE1TS1BKVGk0cUFSNi1HZG10dFNEU0E&usp=sharing&embedded=true" width="75%" > It's possible to edit an existing document. You must only put the following. To save file in another server, you must capture event on click in the frame and if yoy want to create new, you

Convert docx, doc to base64 android

夙愿已清 提交于 2019-12-01 14:00:14
I am trying to get the docx file as shown below public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == MainActivity.RESULT_OK) { if (resultCode == RESULT_OK) { // Get the Uri of the selected file Uri uri = data.getData(); String uriString = uri.toString(); File myFile = new File(uriString); String path = myFile.getAbsolutePath(); filepath =path; String displayName = null; if (uriString.startsWith("content://")) { Cursor cursor = null; try { cursor = this.getContentResolver().query(uri, null, null,

highlighting text in Docx using c#

痴心易碎 提交于 2019-12-01 13:14:41
I need to highlight a sentence in docx file, I have this code, and its working fine for many documents , but i noticed that for some document the text inside the document is set word by word, not whole sentence, I mean each word with its own Run, so when searching for that sentence, it is not found because it is word by word in the docx. NOTE: I am working with Arabic text. private void HighLightText_userSentence(Paragraph paragraph, string text, string title, string author, decimal percentage, string _color) { string textOfRun = string.Empty; var runCollection = paragraph.Descendants<Run>();

Replace text templates inside .docx (Apache POI, Docx4j or other)

别等时光非礼了梦想. 提交于 2019-12-01 13:09:06
问题 I want to do replacements in MS Word ( .docx ) document using regular expression (java RegEx): Example: …, с одной стороны, и %SOME_TEXT% именуемое в дальнейшем «Заказчик», в лице %SOME_TEXT% действующего на основании %SOME_TEXT% с другой стороны, заключили настоящий Договор о нижеследующем: … I tried to get text templates (like %SOME_TEXT% ) use Apache POI - XWPF and replace text, but replacement is not guaranteed, because POI separates runs => I get something like this( System.out.println

Writing Styled Text to a .docx file

拜拜、爱过 提交于 2019-12-01 11:24:04
I'm trying to write an application that will write text to a .docx file. My application uses a JTextPane so the user can write whatever he/she wants, and it also provides many buttons such as bold, font color, font size... ect. What I'm having a problem with is maintaining the style of the text on the JTextPane to when I write to the .docx file. I'm fairly new to Swing and Apache POI so example code and/or a detailed explanation would be helpful. What I have is this: (pad refers to the JTextPane) FileOutputStream output = new FileOutputStream(file); XWPFDocument document = new XWPFDocument();

How to remove tables and paragraphs containing data from docx in java using apache poi

白昼怎懂夜的黑 提交于 2019-12-01 11:19:24
I have a word template that has multiple similar tables and some paragraphs associated to those tables placed just before them. Depending on the amount of data, I populate some tables and others are not required, so are there paragraphs. I need to remove these tables and paragraphs. As you can see in the image, I need to remove Table 2 and its paragraph Table Parahgraph Please help me how to do it. I tried using document.removeBodyElement(pos) , but it does not help. int startIndex = 0; int endIndex = 0; startIndex = doc.getPosOfTable(doc.getTables().get(0)); startIndex++; endIndex = doc