首先,我们找到之前生成的XSN文件,将它的扩展名改为.zip。然后用任何一种解压工具将其解压,解压后所得到的文件如下图所示:
下面就一个一个来看,
manifest.xsf:顾名思义,就是一个清单,先看看里面都有什么东西吧,打开这个文件后除了头部的各种声明信息外接下来就是包内的文件信息:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<
XSF:FILE
myschema.xsd?,
name
=
"template.xml"
>,<?
xml:namespace
prefix
=
xsf
/><
xsf:file
name
=
"view1.xsl"
>]; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"><
xsf:package
>
<
xsf:files
>
<
xsf:file
name
=
"myschema.xsd"
>
<
xsf:fileProperties
>
<
xsf:property
name
=
"namespace"
type
=
"string"
value
=
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-05-17T14:43:28"
></
xsf:property
>
<
xsf:property
name
=
"editability"
type
=
"string"
value
=
"full"
></
xsf:property
>
<
xsf:property
name
=
"rootElement"
type
=
"string"
value
=
"Form"
></
xsf:property
>
<
xsf:property
name
=
"useOnDemandAlgorithm"
type
=
"string"
value
=
"yes"
></
xsf:property
>
</
xsf:fileProperties
>
</
xsf:file
>
<
xsf:file
name
=
"template.xml"
></
xsf:file
>
<
xsf:file
name
=
"sampledata.xml"
>
<
xsf:fileProperties
>
<
xsf:property
name
=
"fileType"
type
=
"string"
value
=
"sampleData"
></
xsf:property
>
</
xsf:fileProperties
>
</
xsf:file
>
<
xsf:file
name
=
"view1.xsl"
>
<
xsf:fileProperties
>
<
xsf:property
name
=
"lang"
type
=
"string"
value
=
"2052"
></
xsf:property
>
<
xsf:property
name
=
"mode"
type
=
"string"
value
=
"1"
></
xsf:property
>
<
xsf:property
name
=
"componentId"
type
=
"string"
value
=
"31"
></
xsf:property
>
<
xsf:property
name
=
"xmlToEditName"
type
=
"string"
value
=
"11"
></
xsf:property
>
</
xsf:fileProperties
>
</
xsf:file
>
</
xsf:files
>
</
xsf:package
>
|
1
|
<?
xml:namespace
prefix
=
xsf
/><
xsf:file
myschema.xsd?,
name
=
"template.xml"
>
|
1
|
<?
xml:namespace
prefix
=
xsf
/><
xsf:file
myschema.xsd?,
name
=
"template.xml"
><
xsf:file
name
=
"view1.xsl"
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<
xsf:extensions
>
<
xsf:extension
name
=
"SolutionDefinitionExtensions"
>
<
xsf2:solutionDefinition
runtimeCompatibility
=
"client server"
allowClientOnlyCode
=
"no"
>
<
xsf2:offline
openIfQueryFails
=
"yes"
cacheQueries
=
"yes"
></
xsf2:offline
>
<
xsf2:viewsExtension
>
<
xsf2:viewExtension
ref
=
"视图 1"
designMode
=
"normal"
clientOnly
=
"no"
>
<
xsf2:xmlToEditExtension
ref
=
"field1_1"
allowLinkedImages
=
"yes"
excludeEmbeddedImages
=
"yes"
></
xsf2:xmlToEditExtension
>
<
xsf2:xmlToEditExtension
ref
=
"field2_2"
allowLinkedImages
=
"yes"
excludeEmbeddedImages
=
"yes"
></
xsf2:xmlToEditExtension
>
<
xsf2:xmlToEditExtension
ref
=
"LeaderComnts_5"
allowLinkedImages
=
"yes"
excludeEmbeddedImages
=
"yes"
></
xsf2:xmlToEditExtension
>
<
xsf2:xmlToEditExtension
ref
=
"ManagerComnts_6"
allowLinkedImages
=
"yes"
excludeEmbeddedImages
=
"yes"
></
xsf2:xmlToEditExtension
>
</
xsf2:viewExtension
>
</
xsf2:viewsExtension
>
<
xsf2:server
formLocale
=
"zh-CN"
isPreSubmitPostBackEnabled
=
"no"
isMobileEnabled
=
"no"
></
xsf2:server
>
<
xsf2:solutionPropertiesExtension
branch
=
"share"
>
<
xsf2:share
formName
=
"请假申请表Publish"
path
=
"C:\Users\Weiwei\Desktop\infopath\请假申请表Publish.xsn"
accessPath
=
"C:\Users\Weiwei\Desktop\infopath\请假申请表Publish.xsn"
></
xsf2:share
>
</
xsf2:solutionPropertiesExtension
>
</
xsf2:solutionDefinition
>
</
xsf:extension
>
</
xsf:extensions
>
|
接下来的是上面定义的视图信息的具体描述,这里定义了绑定和未绑定的控件,也将mainpane指向了xsl文件,通过xsl文件可以将界面呈现出来。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<
xsf:views
default
=
"视图 1"
>
<
xsf:view
name
=
"视图 1"
caption
=
"视图 1"
>
<
xsf:editing
>
<
xsf:xmlToEdit
name
=
"field1_1"
item
=
"/my:Form/my:Reason"
>
<
xsf:editWith
type
=
"rich"
maxLength
=
"1"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
<
xsf:xmlToEdit
name
=
"field2_2"
item
=
"/my:Form/my:WhereToGo"
>
<
xsf:editWith
type
=
"rich"
maxLength
=
"1"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
<
xsf:xmlToEdit
name
=
"LeaderComnts_5"
item
=
"/my:Form/my:LeaderComnts"
>
<
xsf:editWith
type
=
"rich"
maxLength
=
"1"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
<
xsf:xmlToEdit
name
=
"EndDate_11"
item
=
"/my:Form/my:EndDate"
>
<
xsf:editWith
proofing
=
"no"
autoComplete
=
"no"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
<
xsf:xmlToEdit
name
=
"StartDate_10"
item
=
"/my:Form/my:StartDate"
>
<
xsf:editWith
proofing
=
"no"
autoComplete
=
"no"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
<
xsf:xmlToEdit
name
=
"ManagerComnts_6"
item
=
"/my:Form/my:ManagerComnts"
>
<
xsf:editWith
type
=
"rich"
maxLength
=
"1"
component
=
"xField"
></
xsf:editWith
>
</
xsf:xmlToEdit
>
</
xsf:editing
>
<
xsf:mainpane
transform
=
"view1.xsl"
></
xsf:mainpane
>
<
xsf:unboundControls
>
<
xsf:button
name
=
"CTRL31_5"
></
xsf:button
>
</
xsf:unboundControls
>
</
xsf:view
>
</
xsf:views
>
|
unboundControls定义了没有进行数据绑定的控件,也就是表单中的提交按钮。
接下来的两项是关于schema和命名空间的设置:
1
2
3
4
5
6
|
<
xsf:applicationParameters
application
=
"InfoPath Design Mode"
>
<
xsf:solutionProperties
lastOpenView
=
"view1.xsl"
fullyEditableNamespace
=
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-05-17T14:43:28"
></
xsf:solutionProperties
>
</
xsf:applicationParameters
>
<
xsf:documentSchemas
>
<
xsf:documentSchema
rootSchema
=
"yes"
location
=
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-05-17T14:43:28 myschema.xsd"
></
xsf:documentSchema
>
</
xsf:documentSchemas
>
|
然后是对于初始化数据的设置,也就是新打开一个表单的时候数据源的数据是什么状态,从下面的设置可以看出,初始化数据是指向了template.xml文件。
1
2
3
|
<
xsf:fileNew
>
<
xsf:initialXmlDocument
caption
=
"请假申请表Publish"
href
=
"template.xml"
></
xsf:initialXmlDocument
>
</
xsf:fileNew
>
|
最后是关于提交选项的定义,不知道大家是否还记得之前表单中关于提交的设置项,可以参照前一篇博文来查看提交项的定义。
1
2
3
4
5
6
7
8
|
<
xsf:submit
caption
=
"提交"
disableMenuItem
=
"no"
onAfterSubmit
=
"close"
showStatusDialog
=
"yes"
>
<
xsf:successMessage
>请假申请已提交,请等待审批。</
xsf:successMessage
>
<
xsf:errorMessage
>由于出现错误,无法提交表单。</
xsf:errorMessage
>
<
xsf:davAdapter
name
=
"主提交"
submitAllowed
=
"yes"
overwriteAllowed
=
"no"
>
<
xsf:folderURL
value
=
"http://172.17.9.168/Shared%20Documents/"
></
xsf:folderURL
>
<
xsf:fileName
value
=
"concat(my:Department, "-", my:FullName, "的请假申请单")"
valueType
=
"expression"
></
xsf:fileName
>
</
xsf:davAdapter
>
</
xsf:submit
>
|
通过上面的了解我们发现,XSN文件实际是一个ZIP包,表单中使用的元素及表单设置都被压缩到了这个包里,而manifest是这些资源的目录,也是表单的配置文件。下一篇我会为大家讲解另外几个文件的作用。感谢大家的支持,请大家继续关注我的博客,谢谢。