破解版网上很多:Spire.Office for Java is a combination of Java Office APIs that contains Spire.Doc for Java, Spire.XLS for Java, Spire.PDF for Java, Spire.Presentation for Java and Spire.Barcode for Java.
破解版网上很多:::Spire.Office for .NET is a combination of Enterprise-Level Office .NET API offered by E-iceblue. It includes Spire.Doc, Spire.XLS, Spire.Spreadsheet, Spire.Presentation, Spire.PDF, Spire.DataExport, Spire.OfficeViewer, Spire.PDFViewer, Spire.DocViewer, Spire.Barcode and Spire.Email. Spire.Office contains the most up-to-date versions of the above .NET API.
release of Spire.Office 7.7.6. In this release, Spire.PDF supports creating tagged PDF files and PDF/UA files; Spire.Doc supports reserving the text direction when using the new engine to convert Word to PDF; Spire.Presentation supports cropping slide pictures; Spire.XLS supports calculating "UNICODE" formulas. Moreover, a number of known issues are fixed successfully. More details are listed below. | |||
In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode are included. | |||
Here is a list of changes made in this release | |||
Spire.Doc | |||
Category | ID | Description | |
New feature | - | Supports reserving the text direction when using new engine to convert Word to PDF. | |
Adjustment | - | Abandons public IStyle FindById(int styleId) method. | |
Adjustment | - | Abandons public IStyle FindByIstd(int istd) method. | |
Adjustment | - | Adopts public IStyle FindByIdentifier(int sIdentifier) method. | |
Bug | SPIREPDF-6923 | Fixes the issue that the pagination was incorrect after converting Word to PDF. | |
Bug | SPIREPDF-7103 | Fixes the issue that the content format was incorrect after converting Word to PDF. | |
SPIREPDF-7796 | |||
Bug | SPIREPDF-7591 | Fixes the issue that the line breaks were incorrect after converting Word to PDF. | |
Bug | SPIREPDF-7601 | Fixes the issue that the text in table was incomplete after converting Word to PDF. | |
Bug | SPIREPDF-7660 | Fixes the issue that the application threw the "InvalidOperationException" when loading HTML. | |
Bug | SPIREPDF-7793 | Fixes the issue that the application threw the "InvalidCastException" when replacing picture. | |
Bug | SPIREPDF-7821 | Fixes the issue that the application threw "FileNotFoundException" when loading HTML. | |
Bug | SPIREPDF-7826 | Fixes the issue that the field text was not set correctly. | |
Bug | SPIREPDF-7830 | Fixes the issue that the location of mathematical formula was incorrect after converting Word to PDF. | |
Bug | SPIREPDF-7892 | Fixes the issue that setting LinkToPrevious as false didn't take effect when converting Word to PDF using new engine. | |
Bug | SPIREPDF-7922 | Fixes the issue that the application threw the "InvalidOperationException" when converting Word to PDF. | |
Bug | - | Fixes the reference issue of Comment.CommentMarkEnd and Comment.CommentMarkStart. | |
Bug | SPIREDOC-7218 | Fixes the issue that the count of paragraph characters was incorrect. | |
Bug | SPIREDOC-7317 | Fixes the issue that there are extra columns after merging cells. | |
Bug | SPIREDOC-7467 | Fixes the issue that the application throws "NullReferenceException: Object reference not set to an instance of an object" when loading HTML files. | |
Bug | SPIREDOC-7604 | Fixes the issue that extra border lines in the table after converting Word to PDF. | |
Bug | SPIREDOC-7833 | Fixes the issue that table borders missing after converting HTML to Word. | |
Bug | SPIREDOC-7884 | Fixes the issue that the table position changed after converting HTML to Word. | |
Bug | SPIREDOC-7933 | Fixes the issue with incorrect table layout when generating Doc format documents. | |
Bug | SPIREDOC-7967 | Fixes the issue of image loss after converting RTF to PDF. | |
Bug | SPIREDOC-7968 | Fixed the issue that the multiple columns did not take effect after creating multiple columns and converting Word to PDF. | |
Bug | SPIREDOC-8002 | Fixes the issue that there are extra spaces after inserting text to bookmarks. | |
Bug | SPIREDOC-8033 | Fixes the issue that the Word to PDF converting program hangs. | |
Bug | SPIREDOC-8106 | Fixes the issue of incorrect images after converting Word to PDF | |
Bug | SPIREDOC-8125 | Fixes the issue that the application throws an exception "Property value is of unsupported type" when setting custom properties to Null for a document | |
Spire.PDF | |||
Category | ID | Description | |
New feature | SPIREPDF-3803 | Support creating tagged PDF files. | |
//Note:At present, in order to ensure the validity of the output tagged PDF file, it is necessary to add the valid license of Spire.PDF for .net to remove the red warning watermark.
| |||
//Spire.License.LicenseProvider.SetLicenseKey("valid license key"); | |||
//Create a pdf document | |||
PdfDocument doc = new PdfDocument(); | |||
//Add page | |||
doc.Pages.Add(); | |||
//Set tab order | |||
doc.Pages[0].SetTabOrder(TabOrder.Structure); | |||
//Create PdfTaggedContent | |||
PdfTaggedContent taggedContent = new PdfTaggedContent(doc); | |||
taggedContent.SetLanguage("en-US"); | |||
taggedContent.SetTitle("test"); | |||
//Set font | |||
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 10), true); | |||
PdfSolidBrush brush = new PdfSolidBrush(Color.Black); | |||
//Append elements | |||
PdfStructureElement article = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document); | |||
PdfStructureElement paragraph1 = article.AppendChildElement(PdfStandardStructTypes.Paragraph); | |||
PdfStructureElement span1 = paragraph1.AppendChildElement(PdfStandardStructTypes.Span); | |||
span1.BeginMarkedContent(doc.Pages[0]); | |||
PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Justify); | |||
doc.Pages[0].Canvas.DrawString("Spire.PDF for .NET is a professional PDF API applied to creating, writing, editing, handling and reading PDF files.", | |||
font, brush, new Rectangle(40, 0, 480, 80), format); | |||
span1.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement paragraph2 = article.AppendChildElement(PdfStandardStructTypes.Paragraph); | |||
paragraph2.BeginMarkedContent(doc.Pages[0]); doc.Pages[0].Canvas.DrawString("Spire.PDF for .NET can be applied to easily convert Text, Image, SVG, HTML to PDF and convert PDF to Excel with C#/VB.NET in high quality.", | |||
font, brush, new Rectangle(40, 80, 480, 60), format); | |||
paragraph2.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement figure1 = article.AppendChildElement(PdfStandardStructTypes.Figure); | |||
//Set Alternate text | |||
figure1.Alt = "replacement text1"; | |||
figure1.BeginMarkedContent(doc.Pages[0], null); | |||
PdfImage image = PdfImage.FromFile(@"E-logo.png"); | |||
doc.Pages[0].Canvas.DrawImage(image, new PointF(40, 200), new SizeF(100, 100)); | |||
figure1.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement figure2 = article.AppendChildElement(PdfStandardStructTypes.Figure); | |||
//Set Alternate text | |||
figure2.Alt = "replacement text2"; | |||
figure2.BeginMarkedContent(doc.Pages[0], null); | |||
doc.Pages[0].Canvas.DrawRectangle(PdfPens.Black, new Rectangle(300, 200, 100, 100)); | |||
figure2.EndMarkedContent(doc.Pages[0]); | |||
//Save to file | |||
String result = "CreateTaggedFile_result.pdf"; | |||
doc.SaveToFile(result); | |||
doc.Close(); | |||
New feature | SPIREPDF-4559 | Support creating PDF/UA files. | |
//Note:At present, in order to ensure the validity of the output PDF/UA file, it is necessary to add the valid license of Spire.PDF for .net to remove the red warning watermark. | |||
//Spire.License.LicenseProvider.SetLicenseKey("valid license key"); | |||
//Create a pdf document | |||
PdfDocument doc = new PdfDocument(); | |||
//Add page | |||
doc.Pages.Add(); | |||
//Set tab order | |||
doc.Pages[0].SetTabOrder(TabOrder.Structure); | |||
//Create PdfTaggedContent | |||
PdfTaggedContent taggedContent = new PdfTaggedContent(doc); | |||
taggedContent.SetLanguage("en-US"); | |||
taggedContent.SetTitle("test"); | |||
//Set PDF/UA1 identification | |||
taggedContent.SetPdfUA1Identification(); | |||
//Set font | |||
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 10), true); | |||
PdfSolidBrush brush = new PdfSolidBrush(Color.Black); | |||
//Append elements | |||
PdfStructureElement article = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document); | |||
PdfStructureElement paragraph1 = article.AppendChildElement(PdfStandardStructTypes.Paragraph); | |||
PdfStructureElement span1 = paragraph1.AppendChildElement(PdfStandardStructTypes.Span); | |||
span1.BeginMarkedContent(doc.Pages[0]); | |||
PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Justify); | |||
doc.Pages[0].Canvas.DrawString("Spire.PDF for .NET is a professional PDF API applied to creating, writing, editing, handling and reading PDF files.", | |||
font, brush, new Rectangle(40, 0, 480, 80), format); | |||
span1.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement paragraph2 = article.AppendChildElement(PdfStandardStructTypes.Paragraph); | |||
paragraph2.BeginMarkedContent(doc.Pages[0]); | |||
doc.Pages[0].Canvas.DrawString("Spire.PDF for .NET can be applied to easily convert Text, Image, SVG, HTML to PDF and convert PDF to Excel with C#/VB.NET in high quality.", | |||
font, brush, new Rectangle(40, 80, 480, 60), format); | |||
paragraph2.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement figure1 = article.AppendChildElement(PdfStandardStructTypes.Figure); | |||
//Set Alternate text | |||
figure1.Alt = "replacement text1"; | |||
figure1.BeginMarkedContent(doc.Pages[0], null); | |||
PdfImage image = PdfImage.FromFile(@"E-logo.png"); | |||
doc.Pages[0].Canvas.DrawImage(image, new PointF(40, 200), new SizeF(100, 100)); | |||
figure1.EndMarkedContent(doc.Pages[0]); | |||
PdfStructureElement figure2 = article.AppendChildElement(PdfStandardStructTypes.Figure); | |||
//Set Alternate text | |||
figure2.Alt = "replacement text2"; | |||
figure2.BeginMarkedContent(doc.Pages[0], null); | |||
doc.Pages[0].Canvas.DrawRectangle(PdfPens.Black, new Rectangle(300, 200, 100, 100)); | |||
figure2.EndMarkedContent(doc.Pages[0]); | |||
//Save to file | |||
String result = "CreatePDFUAFile_result.pdf"; | |||
doc.SaveToFile(result); | |||
doc.Close(); | |||
Bug | SPIREPDF-4227 | Fixes the issue that the application threw "System.NotSupportedException" when signing a PDF document with a timestamp server. | |
Bug | SPIREPDF-4596 | Fixes the issue that the content format was incorrect after converting PDF to excel file. | |
Bug | SPIREPDF-5214 | Fixes the issue that the application threw "System.NullReferenceException" when converting PDF to SVG. | |
Bug | SPIREPDF-5247 | Fixes the issue that the stamp content format was incorrect after printing PDF file. | |
Bug | SPIREPDF-5266 | Optimizes the time consumption issue when finding PDF file text. | |
Bug | SPIREPDF-5277 | Fixes the issue that the ReplaceAllText() function didn't take effect. | |
Bug | SPIREPDF-5292 | Optimizes the DrawString() method to draw Html string. | |
Bug | SPIREPDF-5314 | Fixes the issue that the RemoveCustomProperty() function effect was incorrect. | |
Bug | SPIREPDF-5317 | Fixes the issue that the application threw "System.OutOfMemoryException" when compressing PDF images. | |
Bug | SPIREPDF-5318 | Fixes the issue that the output PDF couldn't be opened after converting from a u3d file. | |
Bug | SPIREPDF-5319 | Fixes the issue that the size of the extracted images was incorrect. | |
Bug | SPIREPDF-5330 | Fixes the issue that the QR code of the PDF file was incorrect after converting PDF to image. | |
Bug | SPIREPDF-5331 | Fixes the issue that the application threw "System.NullReferenceException" when extracting text from a PDF/A file. | |
Bug | SPIREPDF-5333 | Fixes the issue that it wasn't able to find text from a PDF file. | |
Bug | SPIREPDF-5336 | Fixes the issue that the application threw "Invalid year in date string" after loading and then directly saving a PDF file. | |
Bug | SPIREPDF-5351 | Fixes the issue that the content lost after printing a PDF file. | |
Bug | SPIREPDF-5305 | Fixes the issue that the application threw "System.IndexOutOfRangeException" when merging PDF files. | |
Spire.PDFViewer | |||
Category | ID | Description | |
Bug | SPIREPDFVIEWER-492 | Optimizes document loading time. | |
Bug | SPIREPDFVIEWER-542 | Fixes the issue that the document became blank when viewing. | |
Bug | SPIREPDFVIEWER-547 | Fixes the issue that the application threw "value can not be null" when rotating PDF. | |
Bug | SPIREPDFVIEWER-551 | Fixes the issue that the stamp was lost when viewing. | |
Spire.XLS | |||
Category | ID | Description | |
New feature | SPIREXLS-3944 | Supports setting whether to keep the number format of the data when exporting to DataTable. | |
ExportTableOptions options = new ExportTableOptions(); | |||
options.KeepDataFormat = false; | |||
DataTable table = sheet.ExportDataTable(1, 1, sheet.LastDataRow, sheet.LastDataColumn, options); | |||
New feature | - | Supports calculating "UNICODE" formulas. | |
Bug | SPIREXLS-3902 | Fixes the issue that the column names of the pivot table were offset after converting Excel to PDF. | |
Bug | SPIREXLS-3957 | Fixes the issue that "System.FormatException: Input string was not in a correct format" was thrown when loading HTML files | |
Bug | SPIREXLS-3966 | Fixes the issue that formulas were not calculated after inserting formulas. | |
Bug | SPIREXLS-3967 | Fixes the issue that "CellRange.DisplayedText" property getting incorrect value. | |
Bug | SPIREXLS-3971 | Fixes the issue that "System.FormatException: The string is not recognized as a valid DateTime" exception was thrown when converting Excel to PDF. | |
Bug | SPIREXLS-3972 | Fixes an issue that the application threw a null pointer exception when getting the name manager for a non-contiguous range. | |
Spire.Presentation | |||
Category | ID | Description | |
New feature | SPIREPPT-1965 | Supports cropping slide picture. | |
SlidePicture slidePicture = (SlidePicture)presentation.Slides[0].Shapes[0]; | |||
slidePicture.Crop(float x, float y, float width, float height); | |||
New feature | SPIREPPT-1984 | Provides InsertPicture(stream) to insert picture from file stream. | |
presentation.Slides[0].Shapes[0].InsertPicture(Stream stream) | |||
New feature | - | Supports creating new chart types in PowerPoint2016 (Waterfall, Treemap, Boxandwhisker, Histogram, Pareto, SunBurst). | |
public void CreateWaterFall(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.WaterFall, new RectangleF(50, 50, 500, 400), false); | |||
chart.ChartData[0, 1].Text = "Series 1"; | |||
string[] categories = { "Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6", "Category 7" }; | |||
for (int i = 0; i < categories.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 0].Text = categories[i]; | |||
} | |||
double[] values = { 100, 20, 50, -40, 130, -60, 70 }; | |||
for (int i = 0; i < values.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 1].NumberValue = values[i]; | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, 1]; | |||
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0]; | |||
chart.Series[0].Values = chart.ChartData[1, 1, values.Length, 1]; | |||
ChartDataPoint chartDataPoint = new ChartDataPoint(chart.Series[0]); | |||
chartDataPoint.Index = 2; | |||
chartDataPoint.SetAsTotal = true; | |||
chart.Series[0].DataPoints.Add(chartDataPoint); | |||
ChartDataPoint chartDataPoint2 = new ChartDataPoint(chart.Series[0]); | |||
chartDataPoint2.Index = 5; | |||
chartDataPoint2.SetAsTotal = true; | |||
chart.Series[0].DataPoints.Add(chartDataPoint2); | |||
chart.Series[0].ShowConnectorLines = true; | |||
chart.Series[0].DataLabels.LabelValueVisible = true; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Right; | |||
chart.ChartTitle.TextProperties.Text = "WaterFall"; | |||
} | |||
public void CreateTreeMap(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.TreeMap, new RectangleF(50, 50, 500, 400), false); | |||
chart.ChartData[0, 3].Text = "Series 1"; | |||
string[,] categories = {{"Branch 1","Stem 1","Leaf 1"},{"Branch 1","Stem 1","Leaf 2"},{"Branch 1","Stem 1", "Leaf 3"}, | |||
{"Branch 1","Stem 2","Leaf 4"},{"Branch 1","Stem 2","Leaf 5"},{"Branch 1","Stem 2","Leaf 6"},{"Branch 1","Stem 2","Leaf 7"}, | |||
{"Branch 2","Stem 3","Leaf 8"},{"Branch 2","Stem 3","Leaf 9"},{"Branch 2","Stem 4","Leaf 10"},{"Branch 2","Stem 4","Leaf 11"}, | |||
{"Branch 2","Stem 5","Leaf 12"},{"Branch 3","Stem 5","Leaf 13"},{"Branch 3","Stem 6","Leaf 14"},{"Branch 3","Stem 6","Leaf 15"}}; | |||
for (int i = 0; i < 15; i++) | |||
{ | |||
for (int j = 0; j < 3; j++) | |||
chart.ChartData[i + 1, j].Text = categories[i, j]; | |||
} | |||
double[] values = { 17, 23, 48, 22, 76, 54, 77, 26, 44, 63, 10, 15, 48, 15, 51 }; | |||
for (int i = 0; i < values.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 3].NumberValue = values[i]; | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 3, 0, 3]; | |||
chart.Categories.CategoryLabels = chart.ChartData[1, 0, values.Length, 2]; | |||
chart.Series[0].Values = chart.ChartData[1, 3, values.Length, 3]; | |||
chart.Series[0].DataLabels.CategoryNameVisible = true; | |||
chart.Series[0].TreeMapLabelOption = TreeMapLabelOption.Banner; | |||
chart.ChartTitle.TextProperties.Text = "TreeMap"; | |||
chart.HasLegend = true; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Top; | |||
} | |||
public void CreateSunBurs(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.SunBurst, new RectangleF(50, 50, 500, 400), false); | |||
chart.ChartData[0, 3].Text = "Series 1"; | |||
string[,] categories = {{"Branch 1","Stem 1","Leaf 1"},{"Branch 1","Stem 1","Leaf 2"},{"Branch 1","Stem 1", "Leaf 3"}, | |||
{"Branch 1","Stem 2","Leaf 4"},{"Branch 1","Stem 2","Leaf 5"},{"Branch 1","Leaf 6",null},{"Branch 1","Leaf 7", null}, | |||
{"Branch 2","Stem 3","Leaf 8"},{"Branch 2","Leaf 9",null},{"Branch 2","Stem 4","Leaf 10"},{"Branch 2","Stem 4","Leaf 11"}, | |||
{"Branch 2","Stem 5","Leaf 12"},{"Branch 3","Stem 5","Leaf 13"},{"Branch 3","Stem 6","Leaf 14"},{"Branch 3","Leaf 15",null}}; | |||
for (int i = 0; i < 15; i++) | |||
{ | |||
for (int j = 0; j < 3; j++) | |||
chart.ChartData[i + 1, j].Value = categories[i, j]; | |||
} | |||
double[] values = { 17, 23, 48, 22, 76, 54, 77, 26, 44, 63, 10, 15, 48, 15, 51 }; | |||
for (int i = 0; i < values.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 3].NumberValue = values[i]; | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 3, 0, 3]; | |||
chart.Categories.CategoryLabels = chart.ChartData[1, 0, values.Length, 2]; | |||
chart.Series[0].Values = chart.ChartData[1, 3, values.Length, 3]; | |||
chart.Series[0].DataLabels.CategoryNameVisible = true; | |||
chart.ChartTitle.TextProperties.Text = "SunBurst"; | |||
chart.HasLegend = true; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Top; | |||
} | |||
public void CreatePareto(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Pareto, new RectangleF(50, 50, 500, 400), false); | |||
chart.ChartData[0, 1].Text = "Series 1"; | |||
string[] categories = { "Category 1", "Category 2", "Category 4", "Category 3", "Category 4", "Category 2", "Category 1", | |||
"Category 1", "Category 3", "Category 2", "Category 4", "Category 2", "Category 3", | |||
"Category 1", "Category 3", "Category 2", "Category 4", "Category 1", "Category 1", | |||
"Category 3", "Category 2", "Category 4", "Category 1", "Category 1", "Category 3", | |||
"Category 2", "Category 4", "Category 1"}; | |||
for (int i = 0; i < categories.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 0].Text = categories[i]; | |||
} | |||
double[] values = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | |||
for (int i = 0; i < values.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 1].NumberValue = values[i]; | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, 1]; | |||
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0]; | |||
chart.Series[0].Values = chart.ChartData[1, 1, values.Length, 1]; | |||
chart.PrimaryCategoryAxis.IsBinningByCategory = true; | |||
chart.Series[1].Line.FillFormat.FillType = FillFormatType.Solid; | |||
chart.Series[1].Line.FillFormat.SolidFillColor.Color = Color.Red; | |||
chart.ChartTitle.TextProperties.Text = "Pareto"; | |||
chart.HasLegend = true; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Bottom; | |||
} | |||
public void CreateHistogram(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Histogram, new RectangleF(50, 50, 500, 400), false); | |||
chart.ChartData[0, 0].Text = "Series 1"; | |||
double[] values = { 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 8, 8, 8, 9, 9, 9, 12, 12, 13, 13, 17, 17, 17, 19, | |||
19, 19, 25, 25, 25, 25, 25, 25, 25, 25, 29, 29, 29, 29, 32, 32, 33, 33, 35, 35, 41, 41, 44, 45, 49, 49 }; | |||
for (int i = 0; i < values.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 1].NumberValue = values[i]; | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, 0]; | |||
chart.Series[0].Values = chart.ChartData[1, 0, values.Length, 0]; | |||
chart.PrimaryCategoryAxis.NumberOfBins = 7; | |||
chart.PrimaryCategoryAxis.GapWidth = 20; | |||
chart.ChartTitle.TextProperties.Text = "Histogram"; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Bottom; | |||
} | |||
public void CreateBoxAndWhisker(Presentation ppt) | |||
{ | |||
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.BoxAndWhisker, new RectangleF(50, 50, 500, 400), false); | |||
string[] seriesLabel = { "Series 1", "Series 2", "Series 3" }; | |||
for (int i = 0; i < seriesLabel.Length; i++) | |||
{ | |||
chart.ChartData[0, i + 1].Text = "Series 1"; | |||
} | |||
string[] categories = {"Category 1", "Category 1", "Category 1", "Category 1", "Category 1", "Category 1", "Category 1", | |||
"Category 2", "Category 2", "Category 2", "Category 2", "Category 2", "Category 2", | |||
"Category 3", "Category 3", "Category 3", "Category 3", "Category 3"}; | |||
for (int i = 0; i < categories.Length; i++) | |||
{ | |||
chart.ChartData[i + 1, 0].Text = categories[i]; | |||
} | |||
double[,] values = new double[18, 3]{{-7,-3,-24},{-10,1,11},{-28,-6,34},{47,2,-21},{35,17,22},{-22,15,19},{17,-11,25}, | |||
{-30,18,25},{49,22,56},{37,22,15},{-55,25,31},{14,18,22},{18,-22,36},{-45,25,-17}, | |||
{-33,18,22},{18,2,-23},{-33,-22,10},{10,19,22}}; | |||
for (int i = 0; i < seriesLabel.Length; i++) | |||
{ | |||
for (int j = 0; j < categories.Length; j++) | |||
{ | |||
chart.ChartData[j + 1, i + 1].NumberValue = values[j, i]; | |||
} | |||
} | |||
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, seriesLabel.Length]; | |||
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0]; | |||
chart.Series[0].Values = chart.ChartData[1, 1, categories.Length, 1]; | |||
chart.Series[1].Values = chart.ChartData[1, 2, categories.Length, 2]; | |||
chart.Series[2].Values = chart.ChartData[1, 3, categories.Length, 3]; | |||
chart.Series[0].ShowInnerPoints = false; | |||
chart.Series[0].ShowOutlierPoints = true; | |||
chart.Series[0].ShowMeanMarkers = true; | |||
chart.Series[0].ShowMeanLine = true; | |||
chart.Series[0].QuartileCalculationType = QuartileCalculation.ExclusiveMedian; | |||
chart.Series[1].ShowInnerPoints = false; | |||
chart.Series[1].ShowOutlierPoints = true; | |||
chart.Series[1].ShowMeanMarkers = true; | |||
chart.Series[1].ShowMeanLine = true; | |||
chart.Series[1].QuartileCalculationType = QuartileCalculation.InclusiveMedian; | |||
chart.Series[2].ShowInnerPoints = false; | |||
chart.Series[2].ShowOutlierPoints = true; | |||
chart.Series[2].ShowMeanMarkers = true; | |||
chart.Series[2].ShowMeanLine = true; | |||
chart.Series[2].QuartileCalculationType = QuartileCalculation.ExclusiveMedian; | |||
chart.HasLegend = true; | |||
chart.ChartTitle.TextProperties.Text = "BoxAndWhisker"; | |||
chart.ChartLegend.Position = ChartLegendPositionType.Top; | |||
} |