我正在尝试格式化一些文本NSTextView
以放置在黑色背景的单行中。一段文本需要左对齐,另一段(但仍在同一行)需要居中。
NSString *header = [NSString stringWithFormat:
@""
"<table style=\"width: 100%; background: black; "
"color: white; font-family: Arial; "
"font-size: 16px;\"><tr><td>"
"1. zadatak"
"</td><td align=\"center\" width=\"100%\">"
""
"%@"
""
"</td></tr></table>"
"", [self.problemname.stringValue uppercaseString]];
不幸的是,无论我指定什么宽度,NSTextView
似乎都忽略了表格宽度。
任何解决方法、不同的方法或其他建议?
有关问题背景的更多信息。
我编写了一个应用程序,用于编写编程竞赛的任务。每个任务作者都以不同的格式提交内容,因此让他们将其标准化为一个简单的捆绑包将大有裨益。
我需要这个作为打印模块。我正在采取几个NSTextView
s 并将它们缝合在一起。
这些竞赛具有我们应该遵循的以下文档格式 -示例 PDF ( GoogleDocs ):
Contest header
+------------------------------------------------+
| 1st Task TITLE 20 points |
+------------------------------------------------+
Introductory text here.
Input
Explanation of input data
Output
Explanation of output data
Sample Data
Input: | Input:
abcd | bcde
|
Output: | Output:
efgh | fghi
|
More info: |
info text |