Newer
Older
XinYang_IOS / XYSW / YH_Untis / WeDocument.m
@zhangfeng zhangfeng on 7 Dec 829 bytes 1.8.0
//
//  WeDocument.m
//  YHScrollView_Test
//
//  Created by Jim on 2021/9/3.
//

#import "WeDocument.h"

@implementation WeDocument

- (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError * _Nullable __autoreleasing *)outError
{
    //目前不支持.page
    if ([contents isKindOfClass:[NSData class]])
    {
        self.documentData = [contents copy];
        self.docFileName = self.fileURL.lastPathComponent;
        if (self.docFileName && self.docFileName.length) {
            NSRange startRange = [self.docFileName rangeOfString:@"."];
            self.docMIMEType= [self.docFileName substringFromIndex:startRange.location];
        }
        self.docLength = self.documentData.length;
    }
    else {
        NSLog(@"读取文件出错!");
        return NO;
    }
    return YES;
}

@end