Ниже приведен пример использования операции SetEaxMd для изменения параметров колонтитулов. В запросе передается моникёр открытого экземпляра экспресс-отчета, шаблон, указывающий необходимость изменить колонтитулы, и метаданные, содержащие параметры различных частей колонтитулов. Результатом работы операции является моникёр измененного экспресс-отчета.
{
"Envelope" :
{
"Body" :
{
"SetEaxMd" :
{
"tEax" :
{
"id" : "S1!M!S!E1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "false",
"header" : "true",
"footer" : "true"
},
"meta" :
{
"header" :
{
"right" :
{
"text" : "&[Picture]",
"imageDocument" :
{
"@isShortcut" : "false",
"i" : "PP_LOGO",
"n" : "PP_logo.jpg",
"k" : "245",
"c" : "3329",
"p" : "4294967295",
"h" : "false"
},
"imageAsBackground" : "true"
},
"margin" :
{
"width" : "0",
"height" : "15",
"units" : "Mm"
}
},
"footer" :
{
"center" :
{
"textColor" : "#333366",
"text" : "Страница &[Page] из &[Pages]"
},
"margin" :
{
"width" : "0",
"height" : "15",
"units" : "Mm"
}
}
},
"metaGet" :
{
"obInst" : "true",
"header" : "true",
"footer" : "true"
}
}
}
}
}
}
{
"Envelope" :
{
"Body" :
{
"SetEaxMdResult" :
{
"changedDims" : "",
"id" :
{
"id" : "S1!M!S!E1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@isShortcut" : "0",
"i" : "EXPRESS_1",
"n" : "Экспресс-отчет",
"k" : "189",
"c" : "2561",
"p" : "182",
"h" : "0"
}
},
"windowsPosition" : "Maximized",
"header" :
{
"left" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#000000",
"imageAsBackground" : "0",
"imageSize" :
{
"width" : "0",
"height" : "0",
"units" : "DLU96"
}
},
"center" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#000000",
"imageAsBackground" : "0",
"imageSize" :
{
"width" : "0",
"height" : "0",
"units" : "DLU96"
}
},
"right" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#000000",
"text" : "&[Picture]",
"imageDocument" :
{
"@isShortcut" : "0",
"i" : "PP_LOGO",
"n" : "PP_logo.jpg",
"k" : "245",
"c" : "3329",
"p" : "182",
"h" : "0"
},
"imageAsBackground" : "1",
"imageSize" :
{
"width" : "14",
"height" : "5",
"units" : "DLU96"
}
},
"margin" :
{
"width" : "-1",
"height" : "15000",
"units" : "Mkm"
}
},
"footer" :
{
"left" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#000000",
"imageAsBackground" : "0",
"imageSize" :
{
"width" : "0",
"height" : "0",
"units" : "DLU96"
}
},
"center" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#333366",
"text" : "Страница &[Page] из &[Pages]",
"imageAsBackground" : "0",
"imageSize" :
{
"width" : "0",
"height" : "0",
"units" : "DLU96"
}
},
"right" :
{
"font" :
{
"family" : "Arial",
"style" : "",
"size" :
{
"width" : "-1",
"height" : "10",
"units" : "DLU96"
}
},
"textColor" : "#000000",
"imageAsBackground" : "0",
"imageSize" :
{
"width" : "0",
"height" : "0",
"units" : "DLU96"
}
},
"margin" :
{
"width" : "-1",
"height" : "15000",
"units" : "Mkm"
}
}
}
}
}
}
}
public static SetEaxMdResult SetPageHeader(MbId mb, EaxId moniker)
{
var somClient = new SomPortTypeClient(); //Прокси-объект для выполнения операций
//Параметры выполнения операции
var tEaxMd = new SetEaxMd()
{
tArg = new SetEaxMdArg()
{
//Шаблон, в соответствии с которым будут изменяться метаданные
pattern = new EaxMdPattern()
{
obInst = false,
header = true,
footer = true
},
meta = new EaxMd()
{
header = new EaxHeader() //Верхний колонтитул
{
right = new GxHeaderPart()
{
imageDocument = FindObjectById(mb, "PP7_LOGO"),
imageAsBackground = true,
text = "&[Picture]"
},
margin = new SizeU() { height= 15 }
},
footer = new EaxHeader() //Нижний колонтитул
{
center = new GxHeaderPart()
{
text = "Страница &[Page] из &[Pages]",
textColor = "#333366"
},
margin = new SizeU() { height = 15 }
}
},
metaGet = new EaxMdPattern() { footer = true, header = true }
},
tEax = moniker
};
//Изменение параметров колонтитулов
var result = somClient.SetEaxMd(tEaxMd);
return result;
}
См. также: