简体   繁体   English

换行或回车返回iPad RTF文件

[英]New Line or Carriage return iPad RTF Files

I have an iPad app that creates Word Documents from data entered. 我有一个iPad应用程序,可从输入的数据创建Word文档。

Originally i was using html word documents but these wont open in Pages. 最初我使用的是html word文档,但这些不会在Pages中打开。

I switch to using a RTF file which works for both. 我改用同时适用于两者的RTF文件。

I have a template where i replace sections of text like so: 我有一个模板,在其中替换文本部分,如下所示:

[template replaceOccurrencesOfString:@"**DATE**" withString:[NSString stringWithFormat:@"%@",startDate] options:NSCaseInsensitiveSearch range:NSMakeRange(0, [template length])];

I can replace the text fine and save as expected. 我可以很好地替换文本并按预期保存。

However the carriage return \\n new line character is ignored. 但是,回车符\\ n新行字符将被忽略。 I have tried replacing the \\n with \\r \\r\\n and \\par to no avail 我尝试用\\ r \\ r \\ n和\\ par替换\\ n无济于事

What do i need to replace the carriage return so that it works once saved. 我需要更换回车架以便保存后重新工作。 Currently it is ignored. 当前它被忽略。

Thank 谢谢

Dan

Failure of that - a way to create Word documents that work on Both Pages and Word would be great 那样做的失败-一种创建可同时在Pages和Word上使用的Word文档的方法会很棒

In word \\r and \\n should be replaced by the ASCII characters 10 and 13. I'm not sure what language you are using, but chr(10) and chr(13) are likely candidates. 在\\ r和\\ n中应该用ASCII字符10和13代替。我不确定您使用的是哪种语言,但是chr(10)和chr(13)可能是候选语言。

http://www.asciitable.com/ http://www.asciitable.com/

Since you asked for possible alternatives, there is a web service you can call ( Docmosis ) which provides the ability to create doc/rtf/other documents from Objective-C and stream back to the device (and/or email/store etc). 由于您询问了可能的替代方法,因此您可以调用一个Web服务( Docmosis ),该服务可以从Objective-C创建doc / rtf /其他文档并流回到设备(和/或电子邮件/商店等)。 You need to be net-connected and happy with the external dependency but it can save you a lot of time (they have an Objective-C sdk). 您需要建立网络连接并对外部依赖关系感到满意,但是它可以节省大量时间(它们具有Objective-C SDK)。 Please note I work for the company that created Docmosis. 请注意,我为创建Docmosis的公司工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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