Hi,
There is a large Excel file. Based on this file, I need to make a report in Word format . I copy the Excel file into an array and create a Word document based on it.
itm:=oExc:Sheets(1):Range("A1:L10000"):Value
However, since the original Excel file contains specific characters (≥, м², etc. ), they are replaced with the "? " character when writing to Word. How can we solve this ? ( you can, of course, move fragments through the Clipboard, but it's very, very long)
Copying from Excel to Word
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Copying from Excel to Word
Do you mean characters like these?original Excel file contains specific characters (degree, root, etc. ),
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Copying from Excel to Word
I mean these symbols - ≥, м², etc.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Copying from Excel to Word
Assume you are using Harbour.
Before opening Excel book, set codepage to UTF8
Now read from Excel and export to your Word document.
After finishing, you can restore your original codepage if you want to.
Before opening Excel book, set codepage to UTF8
Code: Select all
cp := HB_SETCODEPAGE( "UTF8" )
After finishing, you can restore your original codepage if you want to.
Code: Select all
HB_SETCODEPAGE( cp )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Copying from Excel to Word
I set HB_SETCODEPAGE ("UTF8") and read data from an Excel file. But Unicode characters could not be obtained. Solved the problem of copying text fragments with Unicode characters via Clipboard
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Copying from Excel to Word
If you are using Harbour, setting codepage to UTF8 works. I mentioned in my post that I assumed you are using Harbour. I posted my answer after testing and confirming at my end, as I always do.
If you are using xHarbour, it does not work, because xHarbour's OLE functions do not support UTF8.
Copying and pasting works in both Harbour and xHarbour.
If you are using xHarbour, it does not work, because xHarbour's OLE functions do not support UTF8.
Copying and pasting works in both Harbour and xHarbour.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India