Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSAttributedStringMBS class.

Next items

NSAttributedStringMBS.attributedStringWithAttachment(attachment as NSTextAttachmentMBS) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an attributed string with an attachment.
Example
Var content as MemoryBlock = "Hello World"
Var f as NSFileWrapperMBS = NSFileWrapperMBS.initRegularFileWithContents(content)
f.filename = "HelloWorld.txt"

Var a as new NSTextAttachmentMBS(f)
Var s as NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithAttachment(a)

This is a convenience method for creating an attributed string containing an attachment using NSAttachmentCharacter as the base character.

NSAttributedStringMBS.attributedStringWithAttributedString(text as NSAttributedStringMBS) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of the given attributed string.

NSAttributedStringMBS.attributedStringWithDocFormat(data as memoryblock) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes string with content of given DOC file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

Some examples using this method:

NSAttributedStringMBS.attributedStringWithDocFormat(data as memoryblock, byref DocumentAttributes as dictionary) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 12.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes string with content of given DOC file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

NSAttributedStringMBS.attributedStringWithHTMLOld(data as string) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given HTML file data.

With plugin version 9.4 the attributedStringWithHTML method uses the system function to parse html. The old plugin function is available with the name attributedStringWithHTMLOld.

NSAttributedStringMBS.attributedStringWithPath(file as folderitem) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of file at the given file.
Example
// load rtfd file into textarea
Var file as FolderItem = SpecialFolder.Desktop.Child("test.rtfd")
Var n as NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithPath(file)
Var t as NSTextViewMBS = TextArea1.NSTextViewMBS
t.textStorage.setAttributedString(n)

documentAttributes: Optional dictionary to receive the attributes.

See also:

Some examples using this method:

NSAttributedStringMBS.attributedStringWithRTF(data as memoryblock) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given RTF file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

Some examples using this method:

NSAttributedStringMBS.attributedStringWithRTF(data as memoryblock, byref DocumentAttributes as dictionary) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 12.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given RTF file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

NSAttributedStringMBS.attributedStringWithRTFD(data as memoryblock) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given RTFD file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

NSAttributedStringMBS.attributedStringWithRTFD(data as memoryblock, byref DocumentAttributes as dictionary) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 12.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given RTFD file data.

documentAttributes: Optional dictionary to receive the attributes.

See also:

NSAttributedStringMBS.attributedStringWithString(text as string) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given plain text.
Example
// create Hello World in red
Var a as NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithString("Hello World")
Var m as NSMutableAttributedStringMBS = a.mutableCopy

m.addAttribute(a.NSForegroundColorAttributeName, NSColorMBS.redColor, new NSRangeMBS(0, m.length))

// put it in a textarea
TextArea1.NSTextViewMBS.textStorage.setAttributedString m

documentAttributes: Optional dictionary to receive the attributes.

See also:

Some examples using this method:

NSAttributedStringMBS.attributedStringWithString(text as string, withAttributes as dictionary) as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 12.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes string with content of given plain text.

documentAttributes: Optional dictionary to receive the attributes.

See also:

NSAttributedStringMBS.FromClipboard as NSAttributedStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 18.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Queries attributed string from clipboard.

NSAttributedStringMBS.NSAttachmentAttributeName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

NSTextAttachment
Default nil, no attachment

NSAttributedStringMBS.NSAuthorDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.
Example
// get some attributed text:
Var t as new NSAttributedStringMBS
call t.initWithString("Hello World")

// set document attributes
Var dic as new Dictionary
dic.Value(t.NSAuthorDocumentAttribute) = "Test User"

// get rtf
Var rtf as string = t.RTFFromRange(dic)

// write to file
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rtf")
Var b as BinaryStream = BinaryStream.Create(f, true)
b.Write rtf

string containing author name.
Available in Mac OS X v10.4 and later.

Some examples using this method:

NSAttributedStringMBS.NSBackgroundColorAttributeName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.
Example
// add background color for text in text area:

TextArea1.Text = "Hello"

Var tv As NSTextViewMBS = TextArea1.NSTextViewMBS
Var ts As NSTextStorageMBS = tv.TextStorage

Var value As Color = &cFF0000

Var offset As Integer = 0
Var length As Integer = 5

Var range As NSRangeMBS = NSMakeRangeMBS( offset, length )
ts.AddAttribute( NSAttributedStringMBS.NSBackgroundColorAttributeName, value, range )

NSColor
Default nil, no background

Some examples using this method:

NSAttributedStringMBS.NSBackgroundColorDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

NSColor, representing the document-wide page background color.
Mac OS X v10.3 and earlier string constant is "BackgroundColor".
For applications linked on versions prior to Mac OS X v10.5, HTML import sets the NSBackgroundColorDocumentAttribute to NSColorMBS.whiteColor in cases in which the HTML does not specify a background color. For applications linked on Mac OS X v10.5 and later, no NSBackgroundColorDocumentAttribute is set in these cases.
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSBaselineOffsetAttributeName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

Number containing floating point value, as points offset from baseline
Default 0.0

NSAttributedStringMBS.NSBaseURLDocumentOption as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

For HTML documents; NSURL containing base URL. Previous string constant was @"BaseURL"
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSBottomMarginDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.
Example
// get some attributed text:
Var t as new NSAttributedStringMBS
call t.initWithString("Hello World")

// set document attributes
Var dic as new Dictionary
dic.Value(t.NSBottomMarginDocumentAttribute) = 20
dic.Value(t.NSLeftMarginDocumentAttribute) = 20
dic.Value(t.NSRightMarginDocumentAttribute) = 20
dic.Value(t.NSTopMarginDocumentAttribute) = 20
dic.Value(t.NSAuthorDocumentAttribute) = "Test User"

// get rtf
Var rtf as string = t.RTFFromRange(dic)

// write to file
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rtf")
Var b as BinaryStream = BinaryStream.Create(f, true)
b.Write rtf

Number, containing a float, in points.
Mac OS X v10.3 and earlier string constant is "BottomMargin".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSCategoryDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

string containing the document's category.
Available in Mac OS X v10.6 and later.

NSAttributedStringMBS.NSCharacterEncodingDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

Number, containing an int specifying the stringEncoding for the file; for reading and writing plain text files and writing HTML; default for plain text is the default encoding; default for HTML is UTF-8.
Mac OS X v10.3 and earlier string constant is "CharacterEncoding".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSCharacterEncodingDocumentOption as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

For plain text documents; Number containing the unsigned int stringEncoding to override any encoding specified in an HTML document. Previous string constant was @"CharacterEncoding".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSCharacterShapeAttributeName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

An integer value. The value is interpreted as Apple Type Services kCharacterShapeType selector + 1.
The default value is 0 (disable). 1 is kTraditionalCharactersSelector, and so on. Refer to <ATS/SFNTLayoutTypes.h> and "Font Features" in ATSUI Programming Guide for additional information.
Available in Mac OS X v10.0 and later.

NSAttributedStringMBS.NSCocoaVersionDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

Number, containing a float. For RTF files only, stores the version of Cocoa with which the file was created. Absence of this value indicates RTF file not created by Cocoa or its predecessors.
Values less than 100 are pre–Mac OS X; 100 is Mac OS X v10.0 or v10.1; 102 is Mac OS X v10.2 and 10.3; values greater than 102 correspond to values of NSAppKitVersionNumber on Mac OS X v10.4 and later.
Mac OS X v10.3 and earlier string constant is "CocoaRTFVersion".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSCommentDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

string containing document comments.
Available in Mac OS X v10.4 and later.

Some examples using this method:

NSAttributedStringMBS.NSCompanyDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

string containing company or organization name.
Available in Mac OS X v10.4 and later.

Some examples using this method:

NSAttributedStringMBS.NSConvertedDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

Number, containing an int. Indicates whether the file was converted by a filter service.
If missing or 0, the file was originally in the format specified by document type. If negative, the file was originally in the format specified by document type, but the conversion to NSAttributedString may have been lossy. If 1 or more, it was converted to this type by a filter service.
Mac OS X v10.3 and earlier string constant is @"Converted".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSCopyrightDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

string containing document copyright info.
Available in Mac OS X v10.4 and later.

Some examples using this method:

NSAttributedStringMBS.NSCreationTimeDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

NSDate containing the creation date of the document; note that this is not the file system creation date of the file, but of the document.
Available in Mac OS X v10.4 and later.

Some examples using this method:

NSAttributedStringMBS.NSCursorAttributeName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

NSCursor
Default as returned by the NSCursor method IBeamCursor
Available in Mac OS X v10.3 and later.

NSAttributedStringMBS.NSDefaultAttributesDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 16.0 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the document attributes.

NSDictionary containing attributes to be applied to plain files. Used by reader methods. This key in options can specify the default attributes applied to the entire document contents. The document attributes can contain this key indicating the actual attributes used.
Available on Mac OS X 10.11.

NSAttributedStringMBS.NSDefaultAttributesDocumentOption as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

For plain text documents; Dictionary containing attributes to be applied to plain files. Previous string constant was @"DefaultAttributes".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSDefaultTabIntervalDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

Number containing a float. Represents the document-wide default tab stop interval.
Mac OS X v10.3 and earlier string constant is "DefaultTabInterval".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSDocFormatTextDocumentType as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the values for the NSDocumentTypeDocumentAttribute key in the document attributes dictionary.

Microsoft Word document.

NSAttributedStringMBS.NSDocumentTypeDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

How the document was interpreted; one of the values in "Document Types."
Mac OS X v10.3 and earlier string constant is "DocumentType".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSDocumentTypeDocumentOption as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the attribute names for NSAttributedString.

One of the document types described in "Document Types," indicating a document type to be forced when loading the document. Previous string constant was @"DocumentType".
Available in Mac OS X v10.4 and later.

NSAttributedStringMBS.NSEditorDocumentAttribute as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Text MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the names for document wide attributes in a NSAttributedString.

string containing name of person who last edited the document.
Available in Mac OS X v10.4 and later.

Some examples using this method:

Next items

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...