Source formatting in word
Ironically, the macOS-bundled TextEdit doesn’t offer an option to edit…just the text. You can then copy that same section of text, and it’s unstyled. Pasting text into one of those apps strips all styles and fonts. Many apps don’t support rich-text formatting. Since you haven't told us anything meaningful about the table structures, you'll need to adapt the above to suit.Use a text-only editor to paste, then copy the results. Set wdRng = Nothing: Set wdTblSrc = Nothing: Set wdTblTgt = Nothing: Set wdDoc = Nothing: Set wdApp = Nothing Original minus chevrons and intervening text" & vbCr & _ I = InputBox("Required Ouput Format:" & vbCr & _ (i).Range.FormattedText = wdRng.FormattedText Documents.Open(FileName:="Full Path & Name", ReadOnly:=False, AddToRecentFiles:=False) 'Note: A reference to the Word library must be set, via Tools|Referencesĭim wdApp As New Word.Application, wdDoc As Word.Documentĭim wdTblSrc As Word.Table, wdTblTgt As Word.Table, wdRng As Word.Range The thread mentioned earlier is a solution for 1 so the requirement becomes finding a simple technique for doing the required editing either “in flight” or within the destination cell. What I’m now seeking, is to replace that initial simplistic approach with solutions that retain the bold, highlighting etc formatting (so no point in posting existing code).
SOURCE FORMATTING IN WORD CODE
SOURCE FORMATTING IN WORD FULL
The are in pairs and indicate where the original contracted Latin has been expanded to its full form. The text has line endings (vbCr) inserted so the text layout matches the original handwritten document line by line. My cell content example (Latin) would be anything between 5 and 30+ lines similar to:Īd hanc Curiam venit Ricus Roberts unus Tentium Custumar hujus Manerii et in plenaĬuria scdm modum sursumredd in manus Dnor unum Claus terraĬustumar vocat ‘Smallewood’ et unu a Claus terra Custumar vocat The comments may provide the solution, but for the future benefit of all, I’ve decided to post more detail. (In some other languages, strings are just “bytes”!). I have reviewed Copy Text from Table in Word and Retaing Formatting (but require to do more than just copy and paste a cell range). Question: How do I get the cell content with its formatting into a string I can process? Inspection at this point reveals the source formatting has already been lost. StrContent = wordDoc.Tables(iCurrTab).Cell(iCurrRow, iCurrCell).Range.FormattedText My initial approach takes each source cell content to a string variable using e.g. Source formatting is generally bolding, highlighting and use of superscripts. The Word table cell contents are generally several sentences of text and the processing I wish to do varies: straight copy, separate into individual lines (vbCr), concatenate short lines, remove some unwanted characters etc. My vba is in Excel (as I need that for other parts of the processing). The source table cell contents are formatted text, and I wish to take the content of each "source" table cell, process the content, and then store the content in a cell of the table in the destination doc. I have two Word tables (different numbers of rows and columns), lets call them "source" and "dest". Searches have failed to provide an answer to this question.