|
我在引用 知识中心功能中 有一个打开按钮的代码的时候。
出现下面错误。 功能 编译的时候没有错误。
是不是文档必须是通过这个功能上传的时候 才能用这个打开代码?
代码如下
unit MAINFORM;
interface
uses
Business.System, Business.Model, Business.Forms, Business.Data,DocLib;
type
TMAINFORM = class(TForm)
FuncBroker: TFuncBroker;
InfoBrokerSWGDXXCX: TInfoBroker;
PageControl: TPageControl;
TabSheet: TTabSheet;
DataSetBroker2: TDataSetBroker;
ControlBar: TControlBar;
Label3: TLabel;
DataSetBroker1: TDataSetBroker;
DataSetBroker3: TDataSetBroker;
DocView2: TDocView;
DataSetBroker4: TDataSetBroker;
BizToolBar1: TBizToolBar;
Button1: TButton;
DataSetdsWDS: TSQLDataSet;
OpenDialog1: TOpenDialog;
DataSource1: TDataSource;
FIELD_dsWDS_FISDIRECTORY: TUserDataField;
procedure Button1Click(Sender: TObject);
private
function isFile: Boolean;
function GetFileName: String;
public
property FileName: String read GetFileName;
end;
implementation
function TMAINFORM.isFile: Boolean;
begin
result := DataSetdsWDS.FieldByName('FISDIRECTORY').AsString = 'N';
end;
function TMAINFORM.GetFileName: String;
begin
with DataSetdsWDS do
begin
if not Active then Open;
if (RecordCount > 0) then
result := DataSetdsWDS.FieldByName('Path').AsString
else result := '';
end;
end;
procedure TMAINFORM.Button1Click(Sender: TObject);
var
lResult: String;
begin
if not isFile then exit;
try
lResult := TUnStructureDocUtils.OpenFile(Context, FileName, TDocAccessKind.akReadOut);
except
lResult := TUnStructureDocUtils.OpenFile(Context, FileName, TDocAccessKind.akReadOut);
end;
jsDialogs.ShowMsg(lResult, 'OpenFile:');
end;
end.
|
|