Hi,all
are you successed when you'll Embedding Table into a RichEdit document(X64)?
edit: del the false code.
Right now I am far from my puter, but check https://masm32.com/board/index.php?msg=70340
In RichMasm, Ctrl G, tbl=8*3*50 inserts a table with 8 rows and 3 columns, spanning 50% of the page width. When I find time, I'll check how I did it.
Hi,jj2007
Thanks for you responded.
This maybe a bug in RichEdit. the Following code only works with a row, can't raise two rows. i don't know why is that?
edit: del the false code.
Hi, all
now i obtained the correct results. post it here for if someone is going to encounter the same issue,maybe you avoid to take fewer unnecessary road.
RECATABLEROWPARMS RECORD fIdentCells:1,fWrap:1, fKeepFollow:1, fKeep:1, fRTL:1, nAlignment:3
;// 0 - 2 bits - Row alignment (like PARAFORMAT::bAlignment, 1/2/3) (\\trql, trqr, \\trqc)
;// 3 bit - Display cells in RTL order (\tlrow)
;// 4 bit - Keep row together (\\trkeep}
;// 5 bit - Keep row on same page as following row (\\trkeepfollow)
;// 6 bit - Wrap text to right/left (depending on bAlignment) (see \\tdfrmtxtLeftN, \\tdfrmtxtRightN)
;// 7 bit - lparam points at single struct valid for all cells
x_TABLEROWPARMS STRUCT
cbRow BYTE ? ;1
cbCell BYTE ? ;1
cCell BYTE ? ;1
cRow BYTE ? ;1
dxCellMargin SDWORD ? ;4
dxIndent SDWORD ? ;4
dyHeight SDWORD ? ;4
RECATABLEROWPARMS DWORD ? ;4
cpStartRow SDWORD ? ;4
bTableLevel BYTE ? ;1
iCell BYTE ? ;1
x_TABLEROWPARMS ENDS ;26
Px_TABLEROWPARMS typedef ptr x_TABLEROWPARMS
RECATABLECELLPARMS RECORD KQfMergeCont:1, KQfMergeStart:1, KQfVertical:1, KQfMergePrev:1, KQfMergeTop:1, KQnVertAlign:2
;// 0 - 1 bits - Vertical alignment (0/1/2 = top/center/bottom) (\\clvertalt (def), \\clvertalc, \\clvertalb)
;// 2 bit - Top cell for vertical merge (\\clvmgf)
;// 3 bit - Merge with cell above (\\clvmrg)
;// 4 bit - Display text top to bottom, right to left (\\cltxtbrlv)
;// 5 bit - Start set of horizontally merged cells (\\clmgf).
;// 6 bit - Merge with the previous cell (\\clmrg).
x_TABLECELLPARMS STRUCT
dxWidth SDWORD ? ;4
RECATABLECELLPARMS WORD ? ;2
wShading WORD ? ;2
dxBrdrLeft WORD ? ;2 ; Left border width (\clbrdrl\brdrwN) (in twips)
dyBrdrTop WORD ? ;2 ; Top border width (\clbrdrt\brdrwN)
dxBrdrRight WORD ? ;2 ; Right border width (\clbrdrr\brdrwN)
dyBrdrBottom WORD ? ;2 ; Bottom border width (\clbrdrb\brdrwN)
crBrdrLeft COLORREF ? ;4 ; Left border color (\clbrdrl\brdrcf)
crBrdrTop COLORREF ? ;4 ; Top border color (\clbrdrt\brdrcf)
crBrdrRight COLORREF ? ;4 ; Right border color (\clbrdrr\brdrcf)
crBrdrBottom COLORREF ? ;4 ; Bottom border color (\clbrdrb\brdrcf)
crBackPat COLORREF ? ;4 ; Background color (\clcbpat)
crForePat COLORREF ? ;4 ; Foreground color (\clcfpat)
x_TABLECELLPARMS ENDS ;40
Px_TABLECELLPARMS typedef ptr x_TABLECELLPARMS
InsertTable PROC dbRowCnt:BYTE,dbCellCnt:BYTE
LOCAL @rows:x_TABLEROWPARMS
LOCAL @cells:x_TABLECELLPARMS
invoke RtlZeroMemory, addr @rows, sizeof @rows
mov @rows.cbRow, sizeof @rows
mov @rows.cbCell,sizeof @cells
mov al,dbCellCnt
mov @rows.cCell,al
mov al,dbRowCnt
mov @rows.cRow,al
mov @rows.dxCellMargin,1
mov @rows.dxIndent,200
mov @rows.dyHeight,450
;RECORD fIdentCells:1,fWrap:1, fKeepFollow:1, fKeep:1, fRTL:1, nAlignment:3(01/00:Left,10:middle,11:right)
mov eax,10000001b
mov @rows.RECATABLEROWPARMS,eax
mov @rows.cpStartRow,-1
mov @rows.bTableLevel,0
mov @rows.iCell,0
invoke RtlZeroMemory, addr @cells, sizeof @cells
mov @cells.dxWidth,1500
;RECATABLECELLPARMS RECORD KQfMergeCont:1, KQfMergeStart:1, KQfVertical:1, KQfMergePrev:1, KQfMergeTop:1, KQnVertAlign:2(00:top,01:middle,10:bottom)
mov ax,0000010b
mov @cells.RECATABLECELLPARMS,ax
mov @cells.wShading,0
mov @cells.dxBrdrLeft,60
mov @cells.dyBrdrTop,20
mov @cells.dxBrdrRight,60
mov @cells.dyBrdrBottom,80
mov @cells.crBrdrLeft,0FFFF00h
mov @cells.crBrdrTop,0FFh
mov @cells.crBrdrRight,0FF00FFh
mov @cells.crBrdrBottom,080h
mov @cells.crBackPat,0701919h
mov @cells.crForePat,0804040h
EM_INSERTTABLE equ WM_USER + 232 ;
invoke SendMessage,hRichEdit,EM_INSERTTABLE ,addr @rows, addr @cells
.if rax != S_OK
invoke MessageBox,0,CStr("Error: EM_INSERTTABLE"),CStr("Table in RichEdit"),MB_OK
.endif
ret
InsertTable ENDP
The attachment shows a walking demo.
Very useful, six_L, thank you :thumbsup: