New Rich Text Document
- 格式:rtf
- 大小:46.12 KB
- 文档页数:4
Environment: VC6 SP4, 2000.Follow these 10 easy steps to build the OutLookRichEdit control:1. Insert a rich edit control into the dialog.2. Call AfxInitRichEdit() in the InitInstance of the App class or in InitDialog.3. If it does not exist, copy OutLookRichEdit.cpp and OutLookRichEdit.h to theproject directory.4. Click the menu choice Project-Add to Project-Files and select the above-copiedfiles to add the wrapper class to your project.5. Import the hand cursor into the resource and rename it "IDC_LINK".6. Use Classwizard to add a member variable of the rich edit control (CRichEditCtrl).7. Include the OutLookRichEdit.h file in the dialog's header file and change thedeclaration of rich edit member variable, as inCRichEditCtrl m_ctrlText1;toCOutLookRichEdit m_ctrlText1;8. In InitDialog(), add the following code.9.m_ctrlText1.SetRawHyperText(_T("Click <%$here$#100#%>to see the about box."));At this level, if you build the project and run it, you can see the rich edit control with linked text, but nothing would happen if you clicked on the link.To Show a dialog while the link is clicked, you have to add some more code in the dialog class. Before that, have a closer look at the preceding code and hypertext syntax. The link text is enclosed between the "$" symbols and the corresponding dialog's resource value 100 (About Box), enclosed in "#" symbols.You can find the #define values of dialogs in the resource.h file.10. Use ClassWizard to map OnNotify of the dialog and write the correspondingimplementation code in .cpp file, like:11.BOOL CDEMODlg::OnNotify(WPARAM wParam,12. LPARAM lParam,13. LRESULT* pResult)14.{15. NMHDR* pNmHdr = (NMHDR*) lParam;16. if(IDC_RICHEDIT1 == pNmHdr->idFrom){17. switch(pNmHdr->code)18. {19. case IDD_ABOUTBOX:20. CAboutDlg oDlg;21. oDlg.DoModal ();22. break;23. }24. }25. return CDialog::OnNotify(wParam, lParam, pResult);}26. Now, build and run the project. It is recommended that you set the read-onlyattribute to the rich edit control.DownloadsDownload demo project - 23 KbDownload source - 6 Kb在RichEdit中插入BitmapCOleDataSource src;STGMEDIUM sm;sm.tymed=TYMED_GDI;sm.hBitmap=hbmp;sm.pUnkForRelease=NULL;src.CacheData(CF_BITMAP, &sm);LPDATAOBJECT lpDataObject =(LPDATAOBJECT)src.GetInterface(&IID_IDataObject);pRichEditOle->ImportDataObject(lpDataObject, 0, NULL);lpDataObject->Release();字体设置代码最后添加字体变换函数:CHARFORMAT cf;LOGFONT lf;memset(&cf, 0, sizeof(CHARFORMAT));memset(&lf, 0, sizeof(LOGFONT));//判断是否选择了内容BOOL bSelect = (GetSelectionType() != SEL_EMPTY) ? TRUE : FALSE;if (bSelect){GetSelectionCharFormat(cf);}else{GetDefaultCharFormat(cf);}//得到相关字体属性BOOL bIsBold = cf.dwEffects & CFE_BOLD;BOOL bIsItalic = cf.dwEffects & CFE_ITALIC;BOOL bIsUnderline = cf.dwEffects & CFE_UNDERLINE;BOOL bIsStrickout = cf.dwEffects & CFE_STRIKEOUT;//设置属性lf.lfCharSet = cf.bCharSet;lf.lfHeight = cf.yHeight/15;lf.lfPitchAndFamily = cf.bPitchAndFamily;lf.lfItalic = bIsItalic;lf.lfWeight = (bIsBold ? FW_BOLD : FW_NORMAL);lf.lfUnderline = bIsUnderline;lf.lfStrikeOut = bIsStrickout;sprintf(lf.lfFaceName, cf.szFaceName);CFontDialog dlg(&lf);dlg.m_cf.rgbColors = cf.crTextColor;if (dlg.DoModal() == IDOK){dlg.GetCharFormat(cf);//获得所选字体的属性if (bSelect)SetSelectionCharFormat(cf); //为选定的内容设定所选字体elseSetWordCharFormat(cf); //为将要输入的内容设定字体}在RichEdit中实现超链接在RichEdit中实现超链接责任编辑:admin 在CBuilder上制作更新日期:2005-8-6首先在Form上放置一个RichEdit。
如果你想要在JavaScript中将富文本(例如HTML)转换为纯文本,你可以使用各种方法。
下面是一个使用DOMParser和textContent 属性的简单示例:
```javascript
function htmlToText(html) {
var parser = new DOMParser();
var doc = parser.parseFromString(html, "text/html");
return doc.body.textContent;
}
var htmlContent = "<p>这是一段<strong>富文本</strong>内容。
</p>";
var plainText = htmlToText(htmlContent);
console.log(plainText); // 输出: "这是一段富文本内容。
"
```
这个函数首先使用DOMParser将HTML字符串转换为一个HTML文档对象,然后获取该文档的body元素,并返回其textContent 属性,即所有文本内容的集合。
请注意,这种方法可能无法完美地处理所有复杂的HTML结构,
但对于简单的用途来说,它应该足够好了。
对于更复杂的需求,你可能需要使用更高级的HTML解析和清理库。
xrichtext使用方式xrichtext是一种可用于在文本中添加富文本格式的方法。
以下是xrichtext的使用方式:1. 导入xrichtext库:import 'package:xrichtext/xrichtext.dart';2. 创建一个XRichText Widget并设置初始的文本内容:XRichText(initialData: '<p>这是一个示例</p>',)3. 在initialData属性中设置初始的文本内容。
可以使用HTML 标记语言来添加富文本效果,例如:'<p>这是一个示例</p>''<p><strong>这是一个加粗的示例</strong></p>''<p><em>这是一个斜体的示例</em></p>''<p><u>这是一个下划线的示例</u></p>''<p><span style="color: red;">这是一个红色的示例</span></p>'4. 可以通过设置其他属性来自定义XRichText Widget的外观和行为,例如:- padding:设置文本的内边距- textAlign:设置文本的对齐方式- maxLines:设置文本的最大行数- overflow:设置文本的溢出方式5. 可以使用RichTextController来控制XRichText Widget的行为。
例如,可以使用controller属性来获取文本内容或者在运行时更改文本内容:final controller = RichTextController();XRichText(controller: controller,);...// 获取文本内容final text = controller.getHtml();// 设置文本内容controller.setHtml('<p>新的内容</p>');这是xrichtext的基本使用方式,你可以根据自己的需求来自定义和扩展。
我的form1上有打印和打印预览的按钮,想实现按一下就打印richtextbook的内容,看了一下网上的打印代码都超长的,难道没有简单的办法实现吗,最好就几行代码的,功能简单点没关系,望高人相救这个是用03做的你可以看代码用05做..因为03很多代码.我只提取部分功能代码..//打印配置private void printDocument1_PrintPage(object sender,System.Drawing.Printing.PrintPageEventArgs ev){TextReader streamToPrint = (TextReader)newStringReader(this.textBox1.Text);Font printFont = new Font("Arial", 12);float linesPerPage = 0;float yPos = 0;int count = 0;float leftMargin = ev.MarginBounds.Left;float topMargin = ev.MarginBounds.Top;string line=null;//计算每页的行数linesPerPage = ev.MarginBounds.Height /printFont.GetHeight(ev.Graphics) ;// 逐行打印while (count < linesPerPage && ((line=streamToPrint.ReadLine()) != null)){yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));ev.Graphics.DrawString (line, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());count++;}// 还有没有打印内容则另打印一页if (line != null)ev.HasMorePages = true;elseev.HasMorePages = false;}private void Form1_Load(object sender, System.EventArgs e){this.textBox1.Text = "这是要打印的一个文本示例";}//预览private void menuItem2_Click(object sender, System.EventArgs e) {printPreviewDialog1.Document = printDocument1;printPreviewDialog1.ShowDialog();}//打印private void menuItem3_Click(object sender, System.EventArgs e) {try{printDialog1.Document = printDocument1;if(printDialog1.ShowDialog() == DialogResult.OK){printDocument1.Print();}}catch(Exception ex){MessageBox.Show(ex.Message);}}//打开打印文件private void menuItem5_Click(object sender, System.EventArgs e) {if(openFileDialog1.ShowDialog() == DialogResult.OK){textBox1.Clear();StreamReader sr = newStreamReader(openFileDialog1.FileName,Encoding.Default);oldFileName = openFileDialog1.FileName;textBox1.Text = sr.ReadToEnd().ToString();sr.Close();}}//保存打印文件private void menuItem6_Click(object sender, System.EventArgs e) {if(saveFileDialog1.ShowDialog() == DialogResult.OK){StreamWriter asw = new StreamWriter(saveFileDialog1.FileName,true); asw.Write(textBox1.Text);asw.Close();}}。
rich-text是微信小程序的一个组件,可以支持部分HTML节点及属性。
rich-text的属性如下:nodes:值为HTML String时,在组件内部将自动解析为节点列表,推荐直接使用Array类型避免内部转换导致的性能下降。
App-nvue和支付宝小程序不支持HTML String方式,仅支持直接使用节点列表即Array类型,如要使用HTML String,则需自己将HTML String转化为nodes数组,可使用html-parser转换。
在Vue2中,可以使用v-text或v-html指令来渲染文本或HTML内容。
其中,v-text会覆盖元素原有内容,而v-html则会把带标签的字符串渲染成HTML内容。
此外,Vue2还提供了指令来处理属性绑定、事件绑定等操作。
例如,v-bind指令可以用于绑定标签属性,v-on指令可以用于绑定事件。
同时,Vue2还提供了条件渲染指令v-if和v-show,以及列表渲染指令v-for等。
使用rich-text组件时,需要将节点数据以Array类型传入nodes属性中,同时注意节点类型的规范。
例如,type为node时,name属性为标签名String,而children属性则是子节点列表。
另外,要注意全局支持class和style属性,不支持id属性。
以上是rich-text与vue2的使用方法简介,如需了解更多信息,建议查阅微信小程序和Vue2的官方文档或咨询相关开发人员。
richtext 颜色格式
在富文本编辑中,颜色格式通常使用CSS样式来表示。
CSS样式提供了多种设置文本颜色的方式,下面是几种常见的颜色格式:
1. 十六进制颜色码(Hex Color Code):使用6位十六进制数表示颜色,以"#"开头,例如"#FF0000"表示红色。
2. RGB颜色值(RGB Color Value):使用红、绿、蓝三个通道的值来表示颜色,每个通道的值范围是0-255。
例如"rgb(255, 0, 0)"表示红色。
3. RGBA颜色值(RGBA Color Value):与RGB类似,但包含了一个透明度通道,用来控制颜色的透明度。
透明度的值范围是0-1,0表示完全透明,1表示完全不透明。
例如"rgba(255, 0, 0, 0.5)"表示半透明的红色。
4. 颜色名称(Color Name):使用预定义的颜色名称表示,例如"red"表示红色,"blue"表示蓝色。
在使用富文本编辑器时,可以通过设置CSS样式来应用颜色格式。
例如,在HTML中使用<span>标签和style属性来设置文本颜色:<span style="color: #FF0000;">红色文本</span>
上述示例中,color属性指定了文本的颜色为红色(使用十六进制颜色码表示)。
无论是使用哪种颜色格式,都可以根据具体需求来选择。
An updated version of the complete specification (GC0165.exe), version 1.5, is now available from MicrosoftTechnical Support. You can obtain this document from the Microsoft Software Library which is available on the World Wide Web at the following address:/kb/softlib/HeaderThe header has the following syntax:<header> \rtf <charset> \deff? <fonttbl> <filetbl>? <colortbl>? <style sheet>? <listtables>><revtbl>? Each of the various header tables should appear in the order listed in the previous table. Document properties canoccur before and between the header tables.A property must be defined before being referenced, specifically:∙The style sheet must occur before any style usage.∙The font table must precede any reference to a font.∙The \deff keyword must precede any text without an explicit reference to a font, because it specifies the font to use in such cases.Unicode RTFWord 97 is a partially Unicode-enabled application. Text is handled using the 16-bit Unicode characterencoding scheme. Expressing this text in RTF requires a new mechanism, because until this release (version1.5), RTF has only handled 7-bit characters directly and 8-bit characters encoded as hexadecimal. TheUnicode mechanism described here can be applied to any RTF destination or body text.Control word Meaning\ansicpg N This keyword represents the ANSI code page that is used to perform the Unicode to ANSI conversion when writing RTF text. N represents the code page in decimal. This is typicallyset to the default ANSI code page of the run-time environment (for example\ansicpg1252 for U.S. Windows®). The reader can use the same ANSI code page toconvert ANSI text back to Unicode.This keyword should be emitted in the RTF header section right after the \ansi, \mac, \pcor \pca keyword.\upr This keyword represents a destination with two embedded destinations, one represented using Unicode and the other using ANSI. This keyword operates in conjunction with the\ud keyword to provide backward compatibility. The general syntax is as follows:{\upr{keyword ansi_text}{\*\ud{keyword Unicode_text}}}Notice that this keyword-destination does not use the \* keyword; this forces the old RTFreaders to pick up the ANSI representation and discard the Unicode representation.\ud This is a destination that is represented in Unicode. The text is represented using amixture of ANSI translation and use of \u N keywords to represent characters that do nothave the exact ANSI equivalent.Control word Meaning\u N This keyword represents a single Unicode character which has no equivalent ANSIrepresentation based on the current ANSI code page. N represents the Unicode charactervalue expressed as a decimal number.This keyword is followed immediately by equivalent characters in ANSI representation. Inthis way, old readers will ignore the \u N keyword and pick up the ANSI representationproperly. When this keyword is encountered, the reader should ignore the next Ncharacters, where N corresponds to the last \uc N value encountered.As with all RTF keywords, a keyword-terminating space may be present (before the ANSIcharacters) that is not counted in the characters to skip. While this is not likely to occur, a\bin keyword, its argument, and the binary data that follows are considered one characterfor skipping purposes. If an RTF scope delimiter character (that is, an opening or closingbrace) is encountered while scanning skippable data, the skippable data is considered tobe ended before the delimiter. This makes it possible for a reader to perform somerudimentary error recovery. To include an RTF delimiter in skippable data, it must berepresented using the appropriate control symbol (backslash) as in plain text. Any RTFcontrol word or symbol is considered a single character for the purposes of countingskippable characters.An RTF writer, when it encounters a Unicode character with no corresponding ANSIcharacter, should output \u N followed by the best ANSI representation it can manage.Also, if the Unicode character translates into an ANSI character stream with count ofbytes differing from the current Unicode character byte count, it should emit the \uc Nkeyword prior to the \u N keyword to notify the reader of the change.RTF control words generally accept signed 16-bit numbers as arguments. For this reason,Unicode values greater than 32,767 must be expressed as negative numbers.\uc N This keyword represents the number of bytes corresponding to a given \u N Unicodecharacter. This keyword may be used at any time, and values are scoped like characterproperties. That is, a \uc N keyword applies only to text following the keyword, and withinthe same (or deeper) nested braces. On exiting the group, the previous \uc value isrestored. The reader must keep a stack of counts seen and use the most recent one toskip the appropriate number of characters when it encounters a \u N keyword. Whenleaving an RTF group that specified a \uc value, the reader must revert to the previousvalue. A default of 1 should be assumed if no \uc keyword has been seen in the current orouter scopes.A common practice is to emit no ANSI representation for Unicode characters within aUnicode destination context (that is, inside a \ud destination). Typically, the destinationwill contain a \uc0 control sequence. There is no need to reset the count on leaving the\ud destination because the scoping rules will ensure the previous value is restored. Document TextDocument text should be emitted as ANSI characters. If there are Unicode characters that do not have corresponding ANSI characters, they should be output using the \uc N and \u N keywords.For example, the text Lab Value (Unicode characters 0x004c, 0x0061, 0x0062, 0x0393, 0x0056, 0x0061,0x006c, 0x0075, 0x0065) should be represented as follows (assuming a previous \ucl):Lab\u915GvalueDestination TextDestination text is defined as any text represented in an RTF destination. A good example is the bookmark name in the \bkmkstart destination.Any destination containing Unicode characters should be emitted as two destinations within a \upr destination to ensure both that old readers can read it properly and that no Unicode character encoding is lost when read with a new reader.For example, a bookmark name Lab Value (Unicode characters 0x004c, 0x0061, 0x0062, 0x0393, 0x0056,0x0061, 0x006c, 0x0075, 0x0065) should be represented as follows:{\upr{\*\bkmkstart LabGValue}{\*\ud{\*\bkmkstart Lab\u915 Value}}}The first sub-destination contains only ANSI characters, and is the representation that old readers will see. The second sub-destination is a \*\ud destination that contains a second copy of the \bkmkstart destination. This copy can contain Unicode characters and is the representation that Unicode-aware readers must pay attention to (they should ignore the ANSI-only version).Font Table<panose> <data>Control word Meaning\*\panose Destination keyword. This destination contains a 10-byte Panose 1 number. Each byte represents a single font property as described by the Panose 1 standard specification.\fbias N Used to arbitrate between two fonts when a particular character can exist in either non-Far East or Far East font. Word 97 emits the \fbias N keyword only in the context ofbullets or list information (that is, a \listlevel destination). The default value of 0 for Nindicates a non-Far East font. A value of 1 indicates a Far East font. Additional valuesmay be defined in future releases.Style SheetControl word Meaning\sautoupd Automatically update styles.\shidden Style does not appear in the Styles drop-down in the Style dialog box1 (on the Format menu, click Styles).List TableWord 97 stores bullets and numbering information very differently from earlier releases. For example, in Word 6.0, number formatting data is stored individually with each paragraph. In Word 97, however, all of the formatting information is stored in a pair of document-wide list tables that act as a style sheet, and each individual paragraph stores only an index to one of the tables, like a style index.There are two list tables in Word: the List Table (destination \listtable) and the List Override Table (destination\listoverridetable).The first table Word stores is the List table. A List table is a list of lists (destination \list). Each list contains a number of list properties that pertain to the entire list, and a list of levels (destination \listlevel), each of which contains properties that pertain only to that level.1 The hidden style property can only be accessed using Visual Basic for Applications.Top-level List PropertiesControl word Meaning\listid N Each list must have a unique list ID which should be randomly generated. Thevalue N is a long integer. The list ID cannot be between -1 and -5.\listtemplateid N Each list should have a unique template ID as well, which also should berandomly generated. The template ID cannot be -1. The value N is a longinteger.\listsimple N 1 if the list has one level; 0 if the list has nine levels\listrestarthdn N 1 if the list restarts at each section; 0 if it doesn't. Used for Word 7.0compatibility only.\listname The argument for \listname is a string that is the name of this list. Namesallow ListNum fields to specify the list they belong to. This is a destinationcontrol word.List LevelsEach list consists of either one or nine list levels depending upon whether the \listsimple flag is set. Each list level contains a number of properties that specify the formatting for that level, such as the start-at value, the text string surrounding the number, its justification and indents, and so on.Control word Meaning\levelstartat N N specifies the start-at value for the level.\levelnfc N Specifies the number type for the level:0 Arabic (1, 2, 3)1 Uppercase Roman numeral (I, II, III)2 Lowercase Roman numeral (i, ii, iii)3 Uppercase letter (A, B, C)4 Lowercase letter (a, b, c)5 Ordinal number (1st, 2nd, 3rd)6 Cardinal text number (One, Two Three)7 Ordinal text number (First, Second, Third)22 Arabic with leading zero (01, 02, 03, ..., 10, 11)23 Bullet (no number at all)255 No numberControl word Meaning\leveljc N0 Left justified1 Centered2 Right justified\levelold N 1 if this level was converted from Word 6.0 or 7.0, 0 if it is a native Word 97 level.\levelprev N 1 if this level includes the text from the previous level (used for Word 7.0 compatibilityonly); otherwise, the value is 0. This keyword will only be valid if the \levelold N keyword isemitted.\levelprevspace N1 if this level includes the indentation from the previous level (used for Word 7.0compatibility only); otherwise the value is 0. This keyword will only be valid if the\leveloldN keyword is emitted.\levelindent N Minimum distance from the left indent to the start of the paragraph text (used for Word7.0 compatibility only). This keyword will only be valid if the \levelold N keyword is emitted.\levelspace N Minimum distance from the right edge of the number to the start of the paragraph text(used for Word 7.0 compatibility only). This keyword will only be valid if the \levelold Nkeyword is emitted.\leveltext The argument for this level should be the number format string for this level. The firstcharacter is the length of the string, and any numbers within the level should be replacedby the index of the level they represent. For example, a level three number such as“1.1.1.” would generate the following RTF{\leveltext \’06\’00.\’01.\’02.}where’06 is the string length, \’00, \’01, and \’02 are the level place holders, and theperiods are the surrounding text. This is a destination control word.\levelnumbers The argument for this destination should be a string which gives the offsets into the\leveltext of the level place holders. In the “1.1.1.” example above, the \levelnumbersRTF should be{\levelnumbers \’01\’03\’05}because the level place holders have indices 1, 3, and 5. This is a destination controlword.\levelfollow N Specifies which character follows the level text:0 Tab1 Space2 Nothing\levellegal N 1 if any list numbers from previous levels should be converted to arabic numbers; 0 if they should be left with the format specified by their own level’s definition.\levelnorestart N 1 if this level does not restart its count each time a number of a higher level is reached; 0 if this level does restart its count each time a number of a higher level is reached.In addition to all of these properties, each list level can contain any character properties (all of which affect all text for that level) and any combination of three paragraph properties: left indents, first line left indents, and tabs—each of which must be of a the jclisttab type. These paragraph properties will be automatically applied to any paragraph in the list.List Override TableThe List Override table is a list of list overrides (destination \listoverride). Each list override contains the listid of one of the lists in the List table, as well as a list of any properties it chooses to override. Each paragraph will contain a list override index (keyword ls) which is a 1-based index into this table. Most list overrides don’t override any properties—instead, they provide a level of indirection to a list. There are generally two types of list overrides: (1) formatting overrides, which allow a paragraph to be part of a list and are numbered along with the other members of the list, but have different formatting properties; and, (2) start-at overrides, which allow a paragraph to share the formatting properties of a list, but have a different start-at values. The first element in the document with each list override index takes the start-at value the list override specifies as its value, while each subsequent element is assigned the number succeeding the previous element of the list.List overrides have a few top-level keywords, including a \listoverridecount, which contains a count of the number of levels whose format is overridden. This \listoverridecount should always be either 1 or 9, depending upon whether the list to be overridden is simple or multilevel. All of the actual override information is stored within a list of list override levels (destination \lfolevel).Control word Meaning\listid N Should exactly match the \listid of one of the lists in the List table. The value N is along integer.\listoverridecount N Number of list override levels within this list override (from 0 or 9).\ls The (1-based) index of this \listoverride in the \listoverride table. This value shouldnever be zero inside a \listoverride, and must be unique for all \listoverrides within adocument. The valid values are from 1 to 2000.List Override LevelEach list override level contains flags to specify whether the formatting or start-at values are being overridden for each level. If the format flag (listoverrideformat) is given, the lfolevel should also contain a list level (listlevel). If the start-at flag (listoverridestart) is given, a start-at value must be provided. If the start-at is overridden but the format is not, then a levelstartat should be provided in the lfolevel itself. If both start-at and format are being overridden, put the levelstartat inside the listlevel contained in the lfolevel.Control word Meaning\listoverridestart N Should exactly match the listID of one of the lists in the List Table. The value N is along integer.\listoverrideformat N Number of List Override Levels within this List Override (should be either 1 or 9). Bullets and Numbering (Lists)Each paragraph that is part of a list must contain some keyword to indicate which list it is in, and which level of the list it belongs to. Word 97 also provides the flat text representation of each number (in the listtext destination). In RTF readers that don’t understand Word 97 numbering, the paragraph number and the appropriate character properties will be inserted at the beginning of the paragraph. Any RTF reader that does understand Word 97 numbering should ignore the entire listtext destination.Control word Meaning\ls Should exactly match the ls for one of the list overrides in the List Override table.\ilvl The 0-based level of the list to which the paragraph belongs. For all simple lists, thisshould always be 0. For multilevel lists, it can be 0-8.Control word Meaning\listtext Contains the flat text representation of the number, including character properties. Should be ignored by any reader that understands Word 97 numbering. This is a destinationcontrol word.Document AreaDocument Formatting PropertiesControl Word Meaning\windowcaption Sets the caption text for the document window. This is a string value.\hlinkbase The base address that is used for the path of all relative hyperlinks inserted in thedocument. This can be a path or an Internet address (URL).\doctypeN An integer (0-2) that describes the document type for AutoFormat:0 General Document (for formatting most documents, the default)1 Letter (for formatting letters, and used by Letter Wizard)2 E-mail (for formatting e-mail, and used by WordMail)\fromtext Indicates document was originally plain text.\deflangfe Default language ID for Asian versions of Word.Deflangfe can also appear in the <header> portion of the RTF.\viewkind N An integer (0-5) that represents the view mode of the document:0 None1 Page Layout view2 Outline view3 Master Document view4 Normal view5 Online Layout view\viewscale N Zoom level of the document; the N argument is a value representing a percentage (the default is 100).\viewzk N An integer (0 to 2) that represents the zoom kind of the document:0 None1 Full page2 Best fit\private Obsolete destination. It has no leading \*. It should be skipped.\bdbfhdr Print body before header/footer. Option for compatibility with Word for the Macintosh 5.x. \dntblnsbdb Don't balance SBCS/DBCS characters. Option for compatibility with Word 6.0 (Japanese). \expshrtn Expand character spaces on line ending with SHIFT+RETURN. Option for compatibility with Word 6.0 (Japanese).\lytexcttp Don’t center exact line height lines.\lytprtmet Use printer metrics to lay out document.\msmcap Small caps like Word for the Macintosh 5.x.\nolead No external leading. Option for compatibility with Word for the Macintosh 5.x.\nospaceforul Don't add space for underline. Option for compatibility with Word 6.0 (Japanese).\noultrlspc Don't underline trailing spaces. Option for compatibility with Word 6.0 (Japanese).\noxlattoyen Don't translate backslash to Yen sign. Option for compatibility with Word 6.0 (Japanese). \oldlinewrap Lines wrap like Word 6.0.\sprsbsp Suppress extra line spacing at bottom of page.\sprstsm Does nothing. This keyword should be ignored.\wpjst Do full justification like WordPerfect 6.x for Windows.\wpsp Set the width of a space like WordPerfect 5.x.\pgbrdrhead Page border surrounds header.\pgbrdrfoot Page border surrounds footer.\pgbrdrt Page border top.\pgbrdrb Page border bottom.\pgbrdrl Page border left.\pgbrdrr Page border right.\brdrart N Page border art; the N argument is a value from 1-165 representing the number of the border.\pgbrdropt N8 Page border measure from text. Always display in fron t option is set to off.32 Page border measure from edge of page. Always display in front option is setto on.40 Page border measure from edge of page. Always display in front option is setto off.\pgbrdrsnap Align paragraph borders and table edges with page border.\crauth N Index into the revision table. The content of the N th group in the revision table is considered to be the author of that revision.Note This keyword is used to indicate formatting revisions, such as bold, italic, and so on. \crdate N Time of the revision. The 32-bit DTTM structure is emitted as a long integer.\revauthdel N Index into the revision table. The content of the N th group in the revision table is considered to be the author of that deletion.\revdttmdel N Time of the deletion. The 32-bit DTTM structure is emitted as a long integer.Note The color, width, border style, and border spacing keywords for page borders are the same as the keywords defined for paragraph borders.Section TextSection Formatting PropertiesControl word Meaning\stextflow Section property for specifying text flow:0 Text flows left to right and top to bottom1 Text flows top to bottom and right to left, vertical2 Text flows left to right and bottom to top3 Text flows right to left and top to bottom4 Text flows left to right and top to bottom, vertical5 Text flows vertically, non-vertical fontNote Page border properties can be used for document sections as well (page border properties are listed in the "Document Formatting" section on page 9 of this document).Paragraph TextParagraph Formatting PropertiesControl word Meaning\outlinelevel N Outline level of paragraph; the N argument is a value from 0-8 representing the outline level of the paragraph. In the default case, no outline level is specified (same as bodytext).Paragraph BordersControl word Meaning\brdrdashsm Dash border (small).\brdrdashd Dot dash border.\brdrdashdd Dot dot dash border.\brdrtriple Triple border.\brdrtnthsg Thick thin border (small).\brdrthtnsg Thin thick border (small).\brdrtnthtnsg Thin thick thin border (small).Control word Meaning\brdrtnthmg Thick thin border (medium).\brdrthtnmg Thin thick border (medium).\brdrtnthtnmg Thin thick thin border (medium).\brdrtnthlg Thick thin border (large).\brdrthtnlg Thin thick border (large).\brdrtnthtnlg Thin thick thin border (large).\brdrwavy Wavy border.\brdrwavydb Double wavy border.\brdrdashdotstr Striped border.\brdremboss Emboss border.\brdrengrave Engrave border.Positioned Objects and Frames\overlay Text flows underneath frame.\posyin Positions the paragraph vertically inside the reference frame.\posyout Positions the paragraph vertically outside the reference frame. Table DefinitionsControl word Meaning\tcelld Sets table cell defaults.\clvertalt Text is top-aligned in cell (the default).\clvertalc Text is centered vertically in cell.\clvertalb Text is bottom-aligned in cell.\cltxlrtb Vertical text aligned left (direction bottom up).\cltxtbrl Vertical text aligned right (direction top down).Character TextCharacter Formatting PropertiesControl word Meaning\animtext N Animated text properties:1 Las Vegas lights2 Blinking background3 Sparkle text4 Marching black ants5 Marching red ants6 Shimmer\strikedl Double strikethrough.\embo Emboss.\impr Engrave.\ulth Thick underline.\uldash Dash underline.\uldashd Dot dash underline.\uldashdd Dot dot dash underline.\ulwave Wave underline.\charscalex N Character scaling value; the N argument is a value representing a percentage (the default is 100).Paragraph numbers and ListNum fields track revision information with special properties applied to the paragraph mark and ListNum field, respectively. The special properties hold the "old" value of the number—the value it held when revision-mark tracking began. At display time, Word checks the current value of the number and compares it with this "old" value to tell if it has changed: if the numbers are different, the old value shows up as deleted and the new value as inserted; if the numbers are the same, Word displays the new value normally, with no revision information. If there was no old value, the new value shows up as inserted. The following table lists the RTF specifications for these special properties.\pnrauth N Index into the revision table. The content of the N th group in the revision table isconsidered to be the author of that revision.Note This keyword is used to indicate paragraph number revisions.\pnrdate N Time of the revision. The 32-bit DTTM structure is emitted as a long integer.Control word Meaning\pnrnot Indicates if the paragraph number for the current paragraph is marked as "inserted."\pnrxst N The keywords \pnrxst, \pnrrgb, \pnrpnbr, and \pnrnfc describe the "deleted number"text for the paragraph number. Their values are binary. Each of these keywords isrepresented as an array. The deleted number is written out with a \pnrstart keyword,followed by the array’s keyword, followed by the first byte of the array, followed by thearray’s keyword followed by the second byte of the array’s keyword, followed by thearray’s keyword followed by the third byte of the array’s keyword, and so on. Thissequence is followed by the \pnrstop keyword.\pnrxst is a 32-item Unicode character array (double bytes for each character) with alength byte as the first number—it has the actual text of the number, with "level"placeholders written out as digits from 0-8.\pnrrgb N Nine-item array of indices of the level place holders in the \pnrxst array.\pnrnfc N Nine-item array of the number format codes of each level (using the same values asthe \levelnfc keyword). The number format code is represented as a short integer.\pnrpnbr N Nine-item array of the actual values of the number in each level. The number isrepresented as a long integer\pnrstart N The \pnrxst, \pnrrgb, \pnrpnbr, and \pnrnfc arrays are each preceded by the\pnrstart keyword, whose argument is 0-3 depending on the array.\pnrstop N The \pnrxst, \pnrrgb, \pnrpnbr, and \pnrnfc arrays are each terminated by the\pnrstop keyword, whose argument is the number of bytes written out in the array.Example:Let’s take an example of the number "3-4b." which represents the third level of the list. The following table lists the values of each array.Array Binary Commentpnrxst \'05\'00-\'01\'02 The length of the string is 5. Then, first level (level 0), followed by adash, followed by the second and third levels (levels 1 and 2), followedby a period.pnrrgb \'01\'03\'04 The level placeholders are at indices 1, 3, and 4 in the string.pnrnfc \'00\'00\'04 The nfc values are arabic (0), arabic (0), and lower case letter (4).pnrpnbr \'03\'04\'02 The numbers or 3, 4, and 2 (b)The RTF for this number is as follows:\pnrstart0\pnrxst0\pnrxst5\pnrxst0\pnrxst1\pnrxst0\pnrxst45\pnrxst0\pnrxst2\pnrxst0\pnrxst3\pnrxst0\pnrxst46 \pnrstop12\pnrstart1\pnrrgb1\pnrrgb3\pnrrgb4\pnrrgb0\pnrrgb0\pnrrgb0\pnrrgb0\pnrrgb0\pnrrgb0\pnrstop9\pnrstart2\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc4\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrnfc0\pnrstop18\pnrstart3\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr3\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr4\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr2\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrpnbr0\pnrstop36\dfrauth N Index into the revision table. The content of the N th group in the revision table isconsidered to be the author of that revision. (Note This keyword is used to indicate thedeleted value of a ListNum field.)\dfrdate N Time of the revision. The 32-bit DTTM structure is emitted as a long integer.\dfrxst Unicode character array with a length byte\dfrstart The \dfrxst array is preceded by the \dfrstart keyword.\dfrstop The \dfrxst array is terminated by the \dfrstop keyword.Example:Let’s take the earlier example "3-4b." If you deleted this number, the RTF code would be \dfrstart0\dfrxst0\dfrxst5\dfrxst0\dfrxst51\dfrxst0\dfrxst45\dfrxst0\dfrxst52\dfrxst0\dfrxst66\dfrxst0\dfrxst46\dfrstop10where 5 is the length byte, 51 is Unicode for "3," 45 is Unicode for "-," 52 is Unicode for "4," and so on. Character Borders and ShadingCharacter shading has the following syntax:<shading> (\chshdng | <pat>) \chcfpat? \chcbpat?<pat> \chbghoriz | \c hbgvert | \chbgfdiag | \chbgbdiag | \chbgcross | \chbgdcross |\chbgdkhoriz | \ch bgdkvert | \chbgdkfdiag | \chbgdkbdiag | \chbgdkcross |\ch bgdkdcrossControl word Meaning\chbrdr Character border (border always appears on all sides).\chshdng N Character shading; the N argument is a value representing the shading of the text in hundreths of a percent.\chcfpat N N is the fill color, specified as an index into the document's color table.。
对于文本编辑,qt提供了很多控件•QLineEdit:单行文本输入,比如用户名密码等简单的较短的或者具有单一特征的字符串内容输入。
使用text、settext读写•QTextEdit:富文本编辑器,支持html显示,可以用sethtml/tohtml进行html文本操作或使用,也可利用setPlainText、toPlainText进行纯文本操作•QPlainTextEdit:纯文本编辑器,使用了近似于textedit的技术并做了纯文本编辑的优化,并具有文章段落的概念也提供了撤销等功能,但不支持html显示。
•QTextBrowser:继承于QTextEdit,仅提供显示功能,并提供了超文本导航功能,如果不需要超文本连接只需要使用QTextEdit并设置QTextEdit::setReadOnly上述都是显示控件,可以确定的是富文本编辑器要用QTextEdit或者QPlainTextEdit,但是肯定不能主动撰写html代码或者逐个处理显示格式实现富文本,实际上Qt提供了相关类:QTextDocument 富文本文档、QTextBlock文本快、QTextFrame框架、QTextTable表格、QTextList列表、QTextCursor 指针位置、QTextXXXXFormat各种数据类型样式。
对于富文本的所有帮助请见官方文档:Rich Text ProcessingQTextEdit和QPlainTextEdit选择:差异是QTextEdit提供了tohtml,如果想在处理完文档,直接根据文档生成html作为博客等内容,可以使用此类,没有需要后者即可注意关系:QTextDocument>QTextFrame>QTextBlock/QTextTable/QTextList前包含后查看两个类的api,均提供了document方法,可以返回QTextDocument指针,用于通过QTextDocument的方式操作文档内容格式,官方范例:Application Example这个比较简单Syntax Highlighter Example语法高亮的例子Text Edit Example类似于word编辑器的例子Calendar Example利用富文本编辑器的方式实现日历(不建议学这个毕竟已经有现成的日历控件,而且文档中往往也不会插入日历)Order Form Example根据一些的参数设置生成报表,其实和上面的原理一样基本使用首先当具有一个edit时,不需要自行创建document,可以直接用document方法可以获取当前edit 的documentQTextDocument只是一个文档,其内还有根节点,需要使用QTextDocument::rootFlrame获取,设置根节点的边框粗细、颜色就类似于设置word文档边框底纹简单范例测试源码GitHub:QtWidgetsExamples#include "mainwindow.h"#include "ui_mainwindow.h"#include <QTextDocument>#include <QTextFrame>#include <QTextBlock>MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow) {ui->setupUi(this);QTextDocument* doc = ui->textEdit->document();QTextFrame *root_frame = doc->rootFrame();QTextFrameFormat root_frame_format = root_frame->frameFormat();//创建框架格式 root_frame_format.setBorderBrush(Qt::darkBlue);//设置边界颜色root_frame_format.setBorder(5);//设置边界宽度root_frame->setFrameFormat(root_frame_format); //给框架使用格式QTextFrameFormat frame_format;frame_format.setBackground(Qt::darkRed);//设置背景色frame_format.setMargin(10);//设置边距frame_format.setPadding(5);//设置填充frame_format.setBorder(2);//设置边界宽度frame_format.setBorderStyle(QTextFrameFormat::BorderStyle_Solid);//设置边框样式frame_format.setPosition(QTextFrameFormat::FloatRight);//右侧frame_format.setWidth(QTextLength(QTextLength::PercentageLength, 40));//宽度设置QTextCursor cursor = ui->textEdit->textCursor();cursor.insertText("A company");cursor.insertBlock();cursor.insertText("321 City Street");cursor.insertBlock();cursor.insertFrame(frame_format);cursor.insertText("Industry Park");cursor.insertBlock();cursor.insertText("Another country");}上述代码仅显示了四行文字,前两行在root跟框架显示,后两行在一个新建的frame中显示,并将frame置于右侧限定了宽度,更多的布局方法请参考:Order Form Example上述并未对文本格式做设置,可以在insertText的第二个参数直接赋予一个文本格式QTextCharFormatQTextCursor光标操作/遍历嵌套Frame/遍历所有Block首先他有各种instert函数可以插入上面提到的各种文档中的数据类型。
RTF●RTF域是Notes中最重要的域,由于它能够保存文本、声音、图片、动画、附件以及按钮操作、链接等多媒体信息资料,是Notes不同于普通关系型数据库的重要特征。
●RTF域的存储容量仅受机器硬盘限制,可以任意大的文件和程序。
●当存储各种类型的RTF域,改变域类型成为文本类型时,仅其中的文本字符能够保存,其他的图片、附件等不能保存在文本类型域中。
●RTF域在编程中,是不能通过公式函数来计算处理的,只能通过LotusScript来对其进行复制操作。
主要属性://获得一个ITEMSet item = doc.GetFirstItem( "Body" )//判断是否为rtfIf item.Type <> RICHTEXT Then Exit SubitemName = contents = item.TextitemType = item.TypeitemSize = item.V alueLength主要方法://增加一行Call item.AddNewLine( 1 )//扩充文本Call item.AppendText( "Book is 64 pages, full color." )//换行Call item.AddNewLine( 1 )Call item.AppendText( "chr(10)" )Call item.AppendText( "chr(12)" )//拷贝Set itemA = doc.GetFirstItem( "Body" )Set memo = New NotesDocument( db )Call itemA.CopyItemToDocument( memo, "Body" )//移除Call item.Remove常见问题:1、默认情况下RTF域取值是每隔80字就加上了换行,解决办法是使用RichItemText的GetFormattedText( tabstrip, lineLength% )方法将lineLength%设置大一些2、64k,每64k进行截取,会自动创建一个同名rtfsxml=""//获得一个rtf域的值Set ritem=docl.GetFirstItem("xmlData")While Not ritem Is Nothingsxml= sxml +ritem.textCall ritem.removeSet ritem=docl.GetFirstItem("xmlData")Wend//创建、截取rtfIf Len(sxml)>30000 ThenIf doc.HasItem("MenuInfo_1") ThenSet ritem=doc.GetFirstItem("MenuInfo_1")Call ritem.removeEnd IfSet ritem=New NotesRichTextItem(doc,"MenuInfo_1")Call ritem.AppendText(Mid(sxml,30001,30000))End If3、视图显示问题Notes是不允许把RTF(Rich Text Field)中的信息直接显示在视图中的列里。
Airport Repr esentative, Chinese, with good c ommunic ation skills, r equired for a Co. E mail: jobs4wtg@gmail.c om Loc ation: Dubai
Industry: Miscellaneous
Email: jobs4wtg@
Published 3rd October 2012
Source: GN Classified s Print Edition
Business Development Executive, Russian / Chinese speaking, required. Email: info@
Location: Dubai
Industry: Sales & Marketing
Email:
info@
Tourism Shipping company is seeking to hire Female Sales Executives. Applicants must have relevant experience in sales within UAE and should be well versed in Chinese / German / Russian. Nationality preferred would be Chinese / Russian / European with the age group of 20-33 years. Candidate should hold a Bachelor Degree with basic computer knowledge. Company working days will be 6 days a week and the salary offered would be between AED 3500/- to 5000/- Other benefits as per the UAE Labour Laws. Send cv with attached photos info@
Location: Dubai
Industry: Sales & Marketing
Contact: 042595754
A leading jewelers in GCC looking for Sales Ladies for there branches in Dubai. Preferably candidates from China/ Russia. Please forward your profiles to hr@skyjewel.ae
Location: Dubai
Industry: Sales & Marketing
Email:
tinju311@
Immediate opening in MALDIVES. Reservations Agent (Ref.: J70) - Chinese / Filipino INTERVIEW IN DUBAI ON 14th - 16th Oct. 2012 (Only interested candidates with 4*/5* hotel experience need apply, superscribing the Ref. No.) BIN EID EXECUTIVE SEARCH - (Specialized in 5* Hotel Segment). Email: mdw@ / Log on to:
Location: Dubai
Industry: Travel
Email:
mdw@
Published 30th September 2012
Source: GN Appointments Print Edition
A Retail Company is looking for a female Chinese Sales Executive. Candidate must have minimum 1 year of UAE experience in the retail field. Excellent communication skills and an outgoing personality are a must. Excellent fluency in English (spoken + written) as well as Mandarin is a must. Candidates not meeting these criteria will not be considered. Candidate must be willing to join immediately. Candidate must be willing to work in any location in Dubai.
Location: Dubai
Industry: Sales & Marketing
Email:
hr14@
Published 25th September 2012
Source: Private
I am a potential and self motivated 26 Years old Customer/consumer Sales and Services Expert with a bachelor degree in information technology, with more than 10 years of experience in Customer Sales and Services, Team leadership/Supervisor ship, Business Administration/coordination/development, Office Administration, IT Solutions and Services, With excellent interpersonal, communication and negotiation skills i am sure i will be a fruitful and a justified addition to your staff, Please contact me if you have an
Location: Dubai
Industry: Secretarial & Office
Email:
zubair.javed01@
Contact: +971551036147
Published 4th October 2012
Source: Private
Excellent opportunity to join the region leading fashion outlet company having more then 30 showrooms in all over UAE.The selected candidate will be placed in mall of emirates.You must have excellent customer handling skills. visa provided. Send us your update cv.
Location: Dubai
Industry: Sales & Marketing
Email:hr.joselyn54@
Sales and promotion girls required with good communication skills and smart send resume with photo and expected salary to hotitjobs@
Location: Dubai
Industry: Sales & Marketing
Contact: 043797611
We are looking for smart and intelligent sales lady for our cosmetic brand candidates should have experience in same filed from one to two years and must be fluent in English with good communication skills and convincing power six hours working time with salary and commission
Location: Dubai
Industry: Sales & Marketing
Email:
tariqsaeed548@
Published 3rd October 2012
Source: Private。