李敢-ms пре 6 година
родитељ
комит
4f0b808e6f

+ 1
- 0
.gitignore Прегледај датотеку

@@ -21,6 +21,7 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
Samples/

# Visual Studio 2015 cache/options directory
.vs/

+ 6
- 0
ConsoleApp1/App.config Прегледај датотеку

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

+ 60
- 0
ConsoleApp1/ConsoleApp1.csproj Прегледај датотеку

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AE75DCD8-F970-4184-8F7D-5E11093519C6}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleApp1</RootNamespace>
<AssemblyName>ConsoleApp1</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xceed.Words.NET\Xceed.Words.NET.csproj">
<Project>{e863d072-aa8b-4108-b5f1-785241b37f67}</Project>
<Name>Xceed.Words.NET</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 103
- 0
ConsoleApp1/Program.cs Прегледај датотеку

@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xceed.Words.NET;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// Creates a document
using (DocX document = DocX.Create(@"R:\6.docx", DocumentTypes.Document))
{
// Add a title
document.InsertParagraph("Bar Chart").FontSize(15d).SpacingAfter(50d).Alignment = Alignment.center;

// Create a bar chart.
var c = new BarChart();
c.AddLegend(ChartLegendPosition.Bottom, false);
c.BarDirection = BarDirection.Column;
c.BarGrouping = BarGrouping.Standard;
c.GapWidth = 200;

// Create the data.
var canada = CreateCanadaExpenses();
var usa = CreateUSAExpenses();
var brazil = CreateBrazilExpenses();

// Create and add series
var s1 = new Series("Brazil");
s1.Color = Color.FromArgb(91, 155, 213);
s1.Bind(brazil, "Category", "Expenses");
s1.ShowValue = true;
c.AddSeries(s1);

var s2 = new Series("USA");
s2.Color = Color.FromArgb(237, 125, 49);
s2.Bind(usa, "Category", "Expenses");
s2.ShowValue = true;
c.AddSeries(s2);

var s3 = new Series("Canada");
s3.Color = Color.Gray;
s3.Bind(canada, "Category", "Expenses");
c.AddSeries(s3);

// Insert the chart into the document.
document.InsertChart(c);
document.InsertParagraph("贺州供电局").FontSize(15).SpacingAfter(10d);

document.Save();
}
}

public static List<ChartData> CreateCanadaExpenses()
{
var canada = new List<ChartData>();
canada.Add(new ChartData() { Category = "Food", Expenses = 100 });
canada.Add(new ChartData() { Category = "Housing", Expenses = 120 });
canada.Add(new ChartData() { Category = "Transportation", Expenses = 140 });
canada.Add(new ChartData() { Category = "Health Care", Expenses = 150 });
return canada;
}

public static List<ChartData> CreateUSAExpenses()
{
var usa = new List<ChartData>();
usa.Add(new ChartData() { Category = "Food", Expenses = 200 });
usa.Add(new ChartData() { Category = "Housing", Expenses = 150 });
usa.Add(new ChartData() { Category = "Transportation", Expenses = 110 });
usa.Add(new ChartData() { Category = "Health Care", Expenses = 100 });
return usa;
}

public static List<ChartData> CreateBrazilExpenses()
{
var brazil = new List<ChartData>();
brazil.Add(new ChartData() { Category = "Food", Expenses = 125 });
brazil.Add(new ChartData() { Category = "Housing", Expenses = 80 });
brazil.Add(new ChartData() { Category = "Transportation", Expenses = 110 });
brazil.Add(new ChartData() { Category = "Health Care", Expenses = 60 });
return brazil;
}

internal class ChartData
{
public string Category
{
get;
set;
}
public double Expenses
{
get;
set;
}
}
}
}

+ 36
- 0
ConsoleApp1/Properties/AssemblyInfo.cs Прегледај датотеку

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ConsoleApp1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApp1")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("ae75dcd8-f970-4184-8f7d-5e11093519c6")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 11
- 0
Examples/obj/x86/Debug/Xceed.Words.NET.Examples.csproj.FileListAbsolute.txt Прегледај датотеку

@@ -9,3 +9,14 @@ D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Examples\obj\x86\Deb
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Examples\obj\x86\Debug\Xceed.Words.NET.Examples.csproj.CopyComplete
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Examples\obj\x86\Debug\Examples.exe
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Examples\obj\x86\Debug\Examples.pdb
D:\Projects\DocX\Examples\bin\Debug\Examples.exe.config
D:\Projects\DocX\Examples\bin\Debug\Examples.exe
D:\Projects\DocX\Examples\bin\Debug\Examples.pdb
D:\Projects\DocX\Examples\bin\Debug\Xceed.Words.NET.dll
D:\Projects\DocX\Examples\bin\Debug\Xceed.Words.NET.pdb
D:\Projects\DocX\Examples\bin\Debug\Xceed.Words.NET.xml
D:\Projects\DocX\Examples\obj\x86\Debug\Xceed.Words.NET.Examples.csprojAssemblyReference.cache
D:\Projects\DocX\Examples\obj\x86\Debug\Xceed.Words.NET.Examples.csproj.CoreCompileInputs.cache
D:\Projects\DocX\Examples\obj\x86\Debug\Xceed.Words.NET.Examples.csproj.CopyComplete
D:\Projects\DocX\Examples\obj\x86\Debug\Examples.exe
D:\Projects\DocX\Examples\obj\x86\Debug\Examples.pdb

+ 25
- 2
Xceed.Words.NET.sln Прегледај датотеку

@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.28307.705
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xceed.Words.NET.Examples", "Examples\Xceed.Words.NET.Examples.csproj", "{F3022BB7-0E40-4C80-A495-37FEAF3671AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xceed.Words.NET", "Xceed.Words.NET\Xceed.Words.NET.csproj", "{E863D072-AA8B-4108-B5F1-785241B37F67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{AE75DCD8-F970-4184-8F7D-5E11093519C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -54,10 +56,31 @@ Global
{E863D072-AA8B-4108-B5F1-785241B37F67}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E863D072-AA8B-4108-B5F1-785241B37F67}.Release|x86.ActiveCfg = Release|Any CPU
{E863D072-AA8B-4108-B5F1-785241B37F67}.Release|x86.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|x86.ActiveCfg = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Debug|x86.Build.0 = Debug|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|Any CPU.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|Any CPU.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|Mixed Platforms.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|x86.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.PerformanceTest|x86.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|Any CPU.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|x86.ActiveCfg = Release|Any CPU
{AE75DCD8-F970-4184-8F7D-5E11093519C6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8AE0AD57-9AF8-4C52-8732-3181B79C1BFF}
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = Xceed.Words.NET.vsmdi
EndGlobalSection

+ 101
- 91
Xceed.Words.NET/Src/Charts/BarChart.cs Прегледај датотеку

@@ -17,109 +17,119 @@ using System.Xml.Linq;

namespace Xceed.Words.NET
{
/// <summary>
/// This element contains the 2-D bar or column series on this chart.
/// 21.2.2.16 barChart (Bar Charts)
/// </summary>
public class BarChart : Chart
{
#region Public Properties

/// <summary>
/// Specifies the possible directions for a bar chart.
/// This element contains the 2-D bar or column series on this chart.
/// 21.2.2.16 barChart (Bar Charts)
/// </summary>
public BarDirection BarDirection
public class BarChart : Chart
{
get
{
return XElementHelpers.GetValueToEnum<BarDirection>(
ChartXml.Element( XName.Get( "barDir", DocX.c.NamespaceName ) ) );
}
set
{
XElementHelpers.SetValueFromEnum<BarDirection>(
ChartXml.Element( XName.Get( "barDir", DocX.c.NamespaceName ) ), value );
}
#region Public Properties

/// <summary>
/// Specifies the possible directions for a bar chart.
/// </summary>
public BarDirection BarDirection
{
get
{
return XElementHelpers.GetValueToEnum<BarDirection>(
ChartXml.Element(XName.Get("barDir", DocX.c.NamespaceName)));
}
set
{
XElementHelpers.SetValueFromEnum<BarDirection>(
ChartXml.Element(XName.Get("barDir", DocX.c.NamespaceName)), value);
}
}

/// <summary>
/// Specifies the possible groupings for a bar chart.
/// </summary>
public BarGrouping BarGrouping
{
get
{
return XElementHelpers.GetValueToEnum<BarGrouping>(
ChartXml.Element(XName.Get("grouping", DocX.c.NamespaceName)));
}
set
{
XElementHelpers.SetValueFromEnum<BarGrouping>(
ChartXml.Element(XName.Get("grouping", DocX.c.NamespaceName)), value);
}
}

/// <summary>
/// Specifies that its contents contain a percentage between 0% and 500%.
/// </summary>
public Int32 GapWidth
{
get
{
return Convert.ToInt32(
ChartXml.Element(XName.Get("gapWidth", DocX.c.NamespaceName)).Attribute(XName.Get("val")).Value);
}
set
{
if ((value < 1) || (value > 500))
throw new ArgumentException("GapWidth lay between 0% and 500%!");
ChartXml.Element(XName.Get("gapWidth", DocX.c.NamespaceName)).Attribute(XName.Get("val")).Value = value.ToString();
}
}

public string Title
{
set
{
var t = new XElement(CXName("t"), "CCCC");
var rpr = new XElement(CXName("rPr"), CAttr("lang", "zh-CN"), CAttr("altLang", "en-US"));
var p = CElement("p",CElement())
}
}

#endregion

#region Overrides

protected override XElement CreateChartXml()
{
return XElement.Parse(
@"<c:barChart xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart"">
<c:barDir val=""col""/>
<c:grouping val=""clustered""/>
<c:gapWidth val=""150""/>
</c:barChart>");
}

#endregion

}

/// <summary>
/// Specifies the possible groupings for a bar chart.
/// Specifies the possible directions for a bar chart.
/// 21.2.3.3 ST_BarDir (Bar Direction)
/// </summary>
public BarGrouping BarGrouping
public enum BarDirection
{
get
{
return XElementHelpers.GetValueToEnum<BarGrouping>(
ChartXml.Element( XName.Get( "grouping", DocX.c.NamespaceName ) ) );
}
set
{
XElementHelpers.SetValueFromEnum<BarGrouping>(
ChartXml.Element( XName.Get( "grouping", DocX.c.NamespaceName ) ), value );
}
[XmlName("col")]
Column,
[XmlName("bar")]
Bar
}

/// <summary>
/// Specifies that its contents contain a percentage between 0% and 500%.
/// Specifies the possible groupings for a bar chart.
/// 21.2.3.4 ST_BarGrouping (Bar Grouping)
/// </summary>
public Int32 GapWidth
public enum BarGrouping
{
get
{
return Convert.ToInt32(
ChartXml.Element( XName.Get( "gapWidth", DocX.c.NamespaceName ) ).Attribute( XName.Get( "val" ) ).Value );
}
set
{
if( ( value < 1 ) || ( value > 500 ) )
throw new ArgumentException( "GapWidth lay between 0% and 500%!" );
ChartXml.Element( XName.Get( "gapWidth", DocX.c.NamespaceName ) ).Attribute( XName.Get( "val" ) ).Value = value.ToString();
}
[XmlName("clustered")]
Clustered,
[XmlName("percentStacked")]
PercentStacked,
[XmlName("stacked")]
Stacked,
[XmlName("standard")]
Standard
}

#endregion

#region Overrides

protected override XElement CreateChartXml()
{
return XElement.Parse(
@"<c:barChart xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart"">
<c:barDir val=""col""/>
<c:grouping val=""clustered""/>
<c:gapWidth val=""150""/>
</c:barChart>" );
}

#endregion

}

/// <summary>
/// Specifies the possible directions for a bar chart.
/// 21.2.3.3 ST_BarDir (Bar Direction)
/// </summary>
public enum BarDirection
{
[XmlName( "col" )]
Column,
[XmlName( "bar" )]
Bar
}

/// <summary>
/// Specifies the possible groupings for a bar chart.
/// 21.2.3.4 ST_BarGrouping (Bar Grouping)
/// </summary>
public enum BarGrouping
{
[XmlName( "clustered" )]
Clustered,
[XmlName( "percentStacked" )]
PercentStacked,
[XmlName( "stacked" )]
Stacked,
[XmlName( "standard" )]
Standard
}
}

+ 496
- 452
Xceed.Words.NET/Src/Charts/Chart.cs
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 7
- 0
Xceed.Words.NET/obj/Debug/Xceed.Words.NET.csproj.FileListAbsolute.txt Прегледај датотеку

@@ -5,3 +5,10 @@ D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Xceed.Words.NET\obj\
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.csproj.CoreCompileInputs.cache
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.dll
D:\Dev\DocumentLibraries\Release\1.3.0\OpenSource\Generated\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.pdb
D:\Projects\DocX\Xceed.Words.NET\bin\Debug\Xceed.Words.NET.XML
D:\Projects\DocX\Xceed.Words.NET\bin\Debug\Xceed.Words.NET.dll
D:\Projects\DocX\Xceed.Words.NET\bin\Debug\Xceed.Words.NET.pdb
D:\Projects\DocX\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.csprojAssemblyReference.cache
D:\Projects\DocX\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.csproj.CoreCompileInputs.cache
D:\Projects\DocX\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.dll
D:\Projects\DocX\Xceed.Words.NET\obj\Debug\Xceed.Words.NET.pdb

Loading…
Откажи
Сачувај