Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes some methods of working with a DOC document view. After starting the example the following operations are executed:
Path to DOC document file is obtained.
Document URL is retrieved.
A DOC document view is created.
The obtained URL is set in DOC document view.
DOC document contents view is retrieved.
Executing the example requires the following file:
exampleForDoc.doc. DOC document.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Regular Report section):
// Delete all window subviews
NSArray *reportSubviews = [self.view subviews];
for(UIView *subView in reportSubviews) {
[subView removeFromSuperview];
}
// Get path to specified DOC document
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"exampleForDoc" ofType:@"doc"];
if (filePath == NULL) {
NSLog(@"Document is not found");
return;
}
// Get document URL
NSURL *url = [NSURL fileURLWithPath:filePath];
// Create a DOC document view
ProceduralDocumentView *documentView = [[ProceduralDocumentView alloc] initWithFrame:self.view.bounds];
//Set document URL for view
[documentView setDocumentURL:url];
// Get document contents view
UIWebView *webview = [documentView webView];
// Get view background color
UIColor *color = [webview backgroundColor];
CGColorRef colorRef = [color CGColor];
// Get view background color alpha component
CGFloat alpha = CGColorGetAlpha(colorRef);
// Display view background color alpha component in the development environment console
NSLog(@"View background color alpha component: %f", alpha);
// Display DOC document view on mobile device screen
[self.view addSubview: documentView];
After executing the example the mobile device screen displays the DOC document view:

The development environment console also displays value of the background color alpha component obtained by means of document contents view:
View background color alpha component: 1.000000
See also: