set the footer in place

泄露秘密 提交于 2019-12-25 02:14:47

问题


setting the footer..

in the above screen the footer is displayed after new member report and reporting period but i dont want like this

I'm working on windows application using C#.

I have generated the "Report" using Ms chart control. While printing and exporting into XPS format, Header and Footer are appearing its fine . But i want the Footer will be displayed at the bottom of the report at present it was appearing just after the header, I want to add this Footer at the bottom using C#. So user can print page with Header and Footer. How to do this.

can any one have idea about this ..

Many thanks....

this is my code

     Title maintitle = kpiChartControl.Titles.Add("New Members Report" + Environment.NewLine);


  maintitle.Alignment = ContentAlignment.TopLeft;
  maintitle.Font = new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold);

  Title rangetitle = kpiChartControl.Titles.Add(string.Format("Report period from : {0} to {1}{2}", dStartDate.Value.ToString(xxx.dateFormat),
    denddate.Value.ToString(xxxx.dateFormat), Environment.NewLine));
  rangetitle.Alignment = ContentAlignment.TopLeft;
  rangetitle.Font = new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold);


  Title footertitle = kpiChartControl.Titles.Add("--------------------------------------------------------" + Environment.NewLine);
  footertitle.Alignment = ContentAlignment.BottomCenter;

  Title gompanytitle = kpiChartControl.Titles.Add("xxxx");
  gompanytitle.Alignment = ContentAlignment.BottomLeft;
  gompanytitle.Font = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Regular);

  Title printedby = kpiChartControl.Titles.Add(string.Format("Printed By ("+text+") On :{0}", dt,Environment.NewLine));
  printedby.Alignment = ContentAlignment.BottomRight;
  printedby.Font = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Regular);


  kpiChartControl.Printing.Print(true);

  kpiChartControl.Titles.Remove(maintitle);
  kpiChartControl.Titles.Remove(rangetitle);
  kpiChartControl.Titles.Remove(footertitle);
 kpiChartControl.Titles.Remove(gompanytitle);
 kpiChartControl.Titles.Remove(printedby);

回答1:


The trick is to use the Docking property. So for all items that you wish to place below the graph, do the following

printedby.Docking = Docking.Bottom;
gompanytitle.Docking = Docking.Bottom;
footertitle.Docking = Docking.Bottom;



回答2:


I'm kinda guessing here to be honest - but it seems to me that you need to be adding the footer in the XPS document, rather than as part of the chart. My guess is that the chart will always by displaying titles at the top.

This SO - about adding header/footer to an XPS - should help: add footer to FlowDocumentsdocuments, both Sauron's and Vikram's answers there should provide the information you need.



来源:https://stackoverflow.com/questions/6831536/set-the-footer-in-place

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!