简体   繁体   中英

How does a list work in an RTF

I've implemented a parser in Java to store the lists as object. But the content of the lists and the heirarchy information are stored in two different blocks. I was trying to find out how does the list like the following gets rendered and store the heirarchy information in an RTF, so that I could do the same in my program.

在此输入图像描述

I find that the content of the list is stored within parent blocks of \\listtext of the "CONTENT" in the below RTF. Also, I assume that information of heirarchy may be stored in \\listtable or \\pnseclvl . But it's hard to find a pattern even after going through specification . Is my assumption wrong? How does the list works in RTF.

List Table

{\*\listtable{\list\listtemplateid692362954\listhybrid{\listlevel\levelnfc0
    \levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698703\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0
    \levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid67698713\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0
    \levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid67698715\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1
    \lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid67698703\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
    \levelspace360\levelindent0{\leveltext\leveltemplateid67698713\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360
    \levelindent0{\leveltext\leveltemplateid67698715\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0
    {\leveltext\leveltemplateid67698703\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
    \leveltemplateid67698713\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
    \leveltemplateid67698715\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid951520154}}

Content:

{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect 
\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen
\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot15166050\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang 
{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang 
{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
\pard\plain \ltrpar\qc \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15166050 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {
\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15166050 TEST}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1399431 
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474\charrsid12025078 \hich\af31506\dbch\af0\loch\f31506 1)\tab}}\pard\plain \ltrpar\s15\ql \fi-360\li360\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\adjustright\rin0\lin360\itap0\pararsid7346474\contextualspace \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 
\insrsid7346474\charrsid12025078 First Section
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 a)\tab}}\pard \ltrpar\s15\ql \fi-360\li720\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\ilvl1\adjustright\rin0\lin720\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 First sub section
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 i)\tab}}\pard \ltrpar\s15\ql \fi-360\li1080\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\ilvl2\adjustright\rin0\lin1080\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 First sub sub section}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7812710 :}{\rtlch\fcs1 \af0 
\ltrch\fcs0 \insrsid7346474 
\par }\pard \ltrpar\s15\ql \li1080\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin1080\itap0\pararsid7812710\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7812710 
Here we begin the actual paragraph text content.
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 2)\tab}}\pard \ltrpar\s15\ql \fi-360\li360\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\adjustright\rin0\lin360\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 Second Section
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 a)\tab}}\pard \ltrpar\s15\ql \fi-360\li720\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\ilvl1\adjustright\rin0\lin720\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 Second sub section
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 i)\tab}}\pard \ltrpar\s15\ql \fi-360\li1080\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\ilvl2\adjustright\rin0\lin1080\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 Second sub sub section
\par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0\afs22 \ltrch\fcs0 \f31506\fs22\insrsid7346474 \hich\af31506\dbch\af0\loch\f31506 3)\tab}}\pard \ltrpar\s15\ql \fi-360\li360\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls5\adjustright\rin0\lin360\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 Third Section
\par }\pard \ltrpar\s15\ql \li360\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin360\itap0\pararsid7346474\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7346474 Paragraph in third section
\par }\pard \ltrpar\s15\ql \li720\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin720\itap0\pararsid15166050\contextualspace {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15166050 
\par } //FOLLOWED BY THEME DATA

A simple, straightforward way is to just use characters as follows

\line \bullet first section
\line \tab  \bullet first sub section text \r\n paraghraph tex
\line \bullet second section
\line \tab  \bullet second sub section text 
\line \bullet third section
\line \tab  \bullet third sub section text  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM