小编mka*_*tzm的帖子

PDFsharp:有没有办法在页面标题中生成"Y页面X"?

这似乎很简单,但我在API中找不到类似getPageCount()的东西.我可以让它返回当前页面,但不是总页数.也许我想念它?

我想以某种方式能够在每页的顶部打印"第1页,共9页",其中"1"当然是当前的页码.

c# pdfsharp migradoc

27
推荐指数
3
解决办法
2万
查看次数

LiveCharts的基础知识 - 如何画线?

我很难理解LiveCharts究竟应该发生什么.我在这里有一块XAML:

<Grid>
    <Grid.Background>
        <ImageBrush ImageSource="/CPF;component/Images/background-top-cropped2.png" Stretch="None"></ImageBrush>
    </Grid.Background>
    <lvc:CartesianChart Series="{Binding myData}" LegendLocation="Right" x:Name="myChart">
        <lvc:CartesianChart.AxisY>
            <lvc:Axis Title="Sales" LabelFormatter="{Binding YFormatter}"></lvc:Axis>
        </lvc:CartesianChart.AxisY>
        <lvc:CartesianChart.AxisX>
            <lvc:Axis Title="Month" Labels="{Binding Labels}"></lvc:Axis>
        </lvc:CartesianChart.AxisX>
    </lvc:CartesianChart>
</Grid>
Run Code Online (Sandbox Code Playgroud)

和代码在这里:

public MainWindow()
{
    InitializeComponent();
    DrawGraphs();
}
public void DrawGraphs()
{
    LineSeries mySeries = new LineSeries
    {
        Values = new ChartValues<int> { 12, 23, 55, 1 }
    };

    myChart.Series.Add(mySeries);
}
Run Code Online (Sandbox Code Playgroud)

在运行时,'myChart.Series.Add(mySeries)'会抛出Null Reference Exception错误.我不确定如何解决这个问题?

.net c# wpf xaml livecharts

8
推荐指数
1
解决办法
1665
查看次数

使用Newtonsoft在C#中迭代嵌套的JSON数组

我有一块JSON如下:

[
  {
    "id": 1,
    "name": "Section1",
    "project_id": 100,
    "configs": [
      {
        "id": 1000,
        "name": "myItem1",
        "group_id": 1
      }
    ]
  },
  {
    "id": 2,
    "name": "Section2",
    "project_id": 100,
    "configs": [
      {
        "id": 1001,
        "name": "myItem2",
        "group_id": 2
      },
      {
        "id": 1002,
        "name": "myItem3",
        "group_id": 2
      },
      {
        "id": 1003,
        "name": "myItem4",
        "group_id": 2
      }
    ]
  },
  {
    "id": 3,
    "name": "Section3",
    "project_id": 100,
    "configs": [
      {
        "id": 1004,
        "name": "myItem5",
        "group_id": 5
      },
    ]
  }
]
Run Code Online (Sandbox Code Playgroud)

我把它作为JArray把它拉进了Memory.

我需要遍历这一点,以便我只从配置子数组中获取id列表.理想情况下,我最终会得到这样的结论:

1000, myItem1 …
Run Code Online (Sandbox Code Playgroud)

c# json json.net

5
推荐指数
1
解决办法
8607
查看次数

MigraDoc:如何在字符串中添加前面的空格?

我有一个文本数据表,我想通过几个空格缩进某些数据,但我尝试的所有内容似乎都会导致我的字符串被自动修剪,并删除前面的空格.现在的PDF看起来像这样:

http://i.imgur.com/KBK6jWS.png

因此,例如,我想稍微缩进'LiabilityOne'和'LiabilityTwo'.我已经尝试在String中添加空格了.在渲染之前添加空格,使用'\ x020'希望坚持使用PadLeft(String.Length + 2,''),一切都没有运气.

当然有一种方法我可以在这些字符串中添加一些前面的空格.我该怎么做?

编辑:

上下文 - 这是为右侧表格的后半部分生成内容的方法.其他一切非常相似.

private void DrawStaticLiabilities()
{
    _PdfVerticalOffset = 85 + (_PdfRowsFSRight * _PdfRowHeight);

    Document tDoc = new Document();
    MigraDoc.DocumentObjectModel.Style style = tDoc.Styles["Normal"];
    style.Font.Name = tPdfFont;
    style.Font.Size = 10;
    Section tSec = tDoc.AddSection();
    MigraDoc.DocumentObjectModel.Tables.Table table2 = new MigraDoc.DocumentObjectModel.Tables.Table();
    table2 = tSec.AddTable();
    table2.Borders.Width = 0.2;
    table2.Rows.LeftIndent = 0;

    Column columnData2 = table2.AddColumn("295pt");
    Column columnValue2 = table2.AddColumn("70pt");
    columnValue2.Borders.Right.Visible = false;

    Row rowAb = table2.AddRow();
    rowAb.Borders.Top.Visible = true;
    rowAb.Borders.Bottom.Visible = false;
    rowAb.Cells[0].AddParagraph(MP.FormFinancialStatement.StaticLiabilites.TopLine);
    rowAb.Cells[1].AddParagraph("");

    Row row1b …
Run Code Online (Sandbox Code Playgroud)

c# pdf string pdfsharp migradoc

2
推荐指数
1
解决办法
4735
查看次数

标签 统计

c# ×4

migradoc ×2

pdfsharp ×2

.net ×1

json ×1

json.net ×1

livecharts ×1

pdf ×1

string ×1

wpf ×1

xaml ×1