【问题标题】:set the footer in place将页脚设置到位
【发布时间】:2011-07-26 14:23:13
【问题描述】:

设置页脚..

在上面的屏幕中,页脚在新成员报告和报告期之后显示,但我不想这样

我正在使用 C# 开发 Windows 应用程序。

我已经使用 Ms 图表控件生成了“报告”。在打印和导出为 XPS 格式时,页眉和页脚都显示得很好。 但我希望页脚将显示在报告的底部,目前它出现在页眉之后,我想使用 C# 在底部添加这个页脚。因此用户可以打印带有页眉和页脚的页面。如何做到这一点。

任何人都可以对此有所了解吗..

非常感谢....

这是我的代码

     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);

【问题讨论】:

  • 有没有人能帮忙解决这个问题.....

标签: c# .net winforms printing mschart


【解决方案1】:

诀窍是使用 Docking 属性。因此,对于您希望放置在图表下方的所有项目,请执行以下操作

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

【讨论】:

    【解决方案2】:

    老实说,我有点猜测 - 但在我看来,您需要在 XPS 文档中添加页脚,而不是作为图表的一部分。我的猜测是图表将始终在顶部显示标题。

    这个 SO - 关于向 XPS 添加页眉/页脚 - 应该会有所帮助:add footer to FlowDocumentsdocuments,那里的 Sauron 和 Vikram 的答案都应该提供您需要的信息。

    【讨论】:

    • 哦,好吧,所以您只是使用打印操作打印到 XPS。哦,好吧,在那种情况下,这根本没有帮助
    猜你喜欢
    • 2010-12-06
    • 2023-03-15
    • 1970-01-01
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多