我正在开发一个应用程序,需要使用Scripting Bridge来处理Apple版本的MS-Word。我需要调用其 sdef 文件中定义的MS-Word命令,但我无法弄清楚如何操作。
sdef文件中命令的定义
<command name="reset" code="sTXTmFBr" description="Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.">
<direct-parameter type="4046"/>
</command>
及其在头文件中的定义
@interface WordApplication : SBApplication
...
- (void) reset:(Word4046)x; // Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.
...
@end
sdef文件中direct-parameter类型的定义:
<enumeration name="4046" code="4046">
<enumerator name="paragraph" code="cpar"/>
<enumerator name="paragraph format" code="w136"/>
</enumeration>
及其在头文件中的定义
enum Word4046 {
Word4046Paragraph = 'cpar',
Word4046ParagraphFormat = 'w136'
};
typedef enum Word4046 Word4046;
我要重置的对象类的定义:
<class name="paragraph format" code="w136" description="Represents all the formatting for a paragraph." inherits="base object" plural="paragraph formats">
...
</class>
及其在头文件中的定义
// Represents all the formatting for a paragraph.
@interface WordParagraphFormat : WordBaseObject
...
@end
我的应用编译且不崩溃的唯一方法是:
WordApplication *sbApplication; // SBObject which represents Word App
WordParagraphFormat *sbParagraph; // SBObject which represents a paragraph format
[sbApplication reset:Word4046ParagraphFormat]
但它显然什么也没做,因为我没有指定我要重置的对象,而是指定该对象的类型。
如何重置sbParagraph对象?
感谢。