ms-word

Parse colors used in Word document, use as backcolor for ListViewItem - wrong color

怎甘沉沦 提交于 2021-01-29 05:02:25
问题 I'm trying to list all font colors used in a Word document, display them as colored ListViewItems. I can parse the doc and get all unique font colors. What does not work? - Getting the ListViewItems in the correct color. Grey35 appears as yellow, green as dark green. Here are my active code sections for that var maxnum = doc.Words.Count; var ind = 0; foreach (Word.Range wd in doc.Content.Words) { if (!string.IsNullOrEmpty(wd.Text.Trim('\r', '\n', ' '))) { ind++; bkwParseColors.ReportProgress

Parse colors used in Word document, use as backcolor for ListViewItem - wrong color

怎甘沉沦 提交于 2021-01-29 04:51:18
问题 I'm trying to list all font colors used in a Word document, display them as colored ListViewItems. I can parse the doc and get all unique font colors. What does not work? - Getting the ListViewItems in the correct color. Grey35 appears as yellow, green as dark green. Here are my active code sections for that var maxnum = doc.Words.Count; var ind = 0; foreach (Word.Range wd in doc.Content.Words) { if (!string.IsNullOrEmpty(wd.Text.Trim('\r', '\n', ' '))) { ind++; bkwParseColors.ReportProgress

Data to Table in Excel Sheet

不想你离开。 提交于 2021-01-29 04:30:49
问题 I was given the assignment of parsing a word document form, and putting it into an Excel sheet. The code below does that with ease.. but I've recently learned I need to put that data into an Excel table instead of just the cells of a sheet. For row = 1 To theTable.Rows.Count `until end of rows isHeaderOrNot = theTable.Cell(row, 0).Range.Text `if first field in row is a header If isHeaderOrNot.Contains("Section") Or isHeaderOrNot.Contains("Field") Then Continue For keyText = theTable.Cell(row,

When using PHPWord can I format inline text when calling addListItem?

浪子不回头ぞ 提交于 2021-01-29 03:38:36
问题 I'm using PHPWord (https://github.com/PHPOffice/PHPWord/tree/develop) to generate a number of bulleted items appearing within a Word document. I am relying on addListItem() to add the bullet items to the document and that is working just fine. The only problem I'm having is that I also need format some of the text appearing in the bulleted item with a bold word appearing first followed by non-bold text appearing afterwards; all within the same line. For example: bold word: more information

Protect a word document programmatically using java

血红的双手。 提交于 2021-01-29 03:33:53
问题 I am creating a word 2003 document from a template XML document using a java code. I need to protect (make read-only) the document after it has been created. The document has some fields as editable (i.e. text form fields of the developer mode) in it, which can be editable after the document is created. Can this be achieved using java? 回答1: If you only need to make the Word Document a Read-Only, you can do it like this: import java.io.File; public class FileReadOnly { public static void main

Open a word document and specify encoding with PowerShell

微笑、不失礼 提交于 2021-01-29 02:52:48
问题 I'm trying to tell PowerShell to open a text file and choose a certain encoding option. By default, when opening this text file in Word manually, it tries to open it with Japanese encoding and so doesn't show certain characters correctly. I've tried lots of different things but nothing works so I'm totally stuck. This text file, amongst others, needs to be converted to PDF on a daily basis. My current script is as follows: $wdFormatPDF = 17 $word = New-Object -ComObject Word.Application $word

Open a word document and specify encoding with PowerShell

谁说胖子不能爱 提交于 2021-01-29 02:43:52
问题 I'm trying to tell PowerShell to open a text file and choose a certain encoding option. By default, when opening this text file in Word manually, it tries to open it with Japanese encoding and so doesn't show certain characters correctly. I've tried lots of different things but nothing works so I'm totally stuck. This text file, amongst others, needs to be converted to PDF on a daily basis. My current script is as follows: $wdFormatPDF = 17 $word = New-Object -ComObject Word.Application $word

Using Word VBA to automate Excel, I get Run-time error '13': Type mismatch when using the .Find function

蓝咒 提交于 2021-01-29 02:16:11
问题 I'm trying to get data from an excel sheet to a word document. I try using the 'Find' function however I keep getting the same error "Type mismatch" on this line: Set FoundRange = .Cells.Find(260707) Here is the subroutine I am running. Sub GetID() Dim oXL As Object Dim oWB As Object Dim oSheet As Object Dim WorkbookToWorkOn As String Dim FoundRange As Range Dim dummyvar As String 'Start a new instance of Excel Set oXL = CreateObject("Excel.Application") 'Line to make Excel Visible or not oXL

Using Word VBA to automate Excel, I get Run-time error '13': Type mismatch when using the .Find function

跟風遠走 提交于 2021-01-29 02:13:46
问题 I'm trying to get data from an excel sheet to a word document. I try using the 'Find' function however I keep getting the same error "Type mismatch" on this line: Set FoundRange = .Cells.Find(260707) Here is the subroutine I am running. Sub GetID() Dim oXL As Object Dim oWB As Object Dim oSheet As Object Dim WorkbookToWorkOn As String Dim FoundRange As Range Dim dummyvar As String 'Start a new instance of Excel Set oXL = CreateObject("Excel.Application") 'Line to make Excel Visible or not oXL

Replacing all occurrences of a string in a Word file by an hyperlink

两盒软妹~` 提交于 2021-01-28 16:31:47
问题 I have to create a Powershell script that reads a Word file (.docx) and replaces strings by hyperlinks. So far, based on this script, I can replace all occurrences of a string by another string easily. With that script, I can look for a string and replace it by an hyperlink. However, only the first occurrence is replaced. Here's my understanding of the problem so far : The first script uses the ReplaceWith and Replace=wdReplaceAll parameters of the Execute function of the Find Interface. The