public ActionResult read(string id) { DocumentEntity doc = _repository.Single <DocumentEntity>(id); var fields = typeof(ConvertComponentType).GetFields(BindingFlags.Static | BindingFlags.Public); var componentName = ConfigurationManager.AppSettings["Component"]; ConvertComponentType selectenum = (ConvertComponentType)Enum.Parse(typeof(ConvertComponentType), componentName, false); ConvertDocument convertdoc = new ConvertDocument(doc, selectenum); ///未考虑到的情况: 如果文档已经解析完毕,是否需要重新解析 ///留下与后续数据存放的逻辑一同实现 ///update 2014-12-11已完成 逻辑在ProcessDocument中实现 JsonDocEntity parseEntity = convertdoc.ProcessDocument(); //若解析文档不成功,则直接返回 if (parseEntity != null) { //若文档已经存储过,则跳过存储逻辑 if (!convertdoc._docEntity.isStore) { convertdoc._docEntity.isStore = true; _repository.Update <DocumentEntity>(convertdoc._docEntity); } return(Json(parseEntity, JsonRequestBehavior.AllowGet)); } return(null); }
public static BaseComponent CreateComponent(DocumentType documenttype, ConvertComponentType componenttype) { switch (documenttype) { case DocumentType.Word: if (componenttype == ConvertComponentType.AsposeComponent) { return(new AsposeWordComponent()); } else if (componenttype == ConvertComponentType.MSComponent) { return(new MSWordComponent()); } return(null); case DocumentType.Excel: if (componenttype == ConvertComponentType.AsposeComponent) { return(new AsposeExcelComponent()); } else if (componenttype == ConvertComponentType.MSComponent) { return(new MSExcelComponent()); } return(null); case DocumentType.PowerPoint: if (componenttype == ConvertComponentType.AsposeComponent) { return(new AsposePPTComponent()); } else if (componenttype == ConvertComponentType.MSComponent) { return(new MSPPTComponent()); } return(null); default: return(null); } }
public WordDocument(DocumentEntity docentity, ConvertComponentType componenttype) : base(docentity, componenttype) { }
public JsonDocEntity ProcessDocument(ConvertComponentType component) { throw new NotImplementedException(); }
public ConvertDocument(DocumentEntity docEntity, ConvertComponentType component) { _docEntity = docEntity; _docConvertComponent = component; }
public ConvertDocument(DocumentEntity docEntity) { _docEntity = docEntity; _docConvertComponent = ConvertComponentType.AsposeComponent; }