我有要求用户编辑富文本编辑功能的注释。然后用户将这些笔记同步到共享点。我的问题是,sharepoint 列类型是否支持存储属性字符串,或者我必须将 NSAttributed 字符串转换为 HTML 标记?sharepoint 是否支持将 unicode 字符属性字符串或 HTML 页面存储为列类型
问问题
127 次
1 回答
0
转换NSAttributedString
为NSData
使用NSKeyedArchiver
和上传:
NSString *theString = @"Example";
NSDictionary *theAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSFont fontWithName:@"Helvetica" size:26], NSFontAttributeName,
[NSColor whiteColor], NSForegroundColorAttributeName, nil];
NSAttributedString *theAttributedString = [[NSAttributedString alloc]
initWithString:theString
attributes: theAttributes];
NSData *theData = [NSKeyedArchiver archivedDataWithRootObject:theAttributedString];
从服务器下载数据并将其转换回NSAttributedString
使用:
NSAttributedString *theAttributedString = [NSKeyedUnarchiver unarchiveObjectWithData:theData];
NSAttributedStrings
通常我以两种格式上传:
- 存档
NSAttributedString
以确保我以后可以检索完全相同的对象。 NSAttributedString
允许搜索和显示服务器端的普通版本。
于 2012-09-18T06:53:12.090 回答