AODL.Document.Content.Tables.Table.InsertChartAt C# (CSharp) Метод

InsertChartAt() публичный Метод

public InsertChartAt ( string cellName, Chart chart ) : void
cellName string
chart AODL.Document.Content.Charts.Chart
Результат void
		public void InsertChartAt(string cellName,Chart chart)
		{
			string endCell= chart.EndCellAddress ;
			
			if (endCell==null)
			{
				int CurRowIndex= chart.GetCellPos (cellName,this).rowIndex ;
				int CurColIndex= chart.GetCellPos (cellName,this).columnIndex ;
				int EndRowIndex = CurRowIndex +15;
				int EndColIndex = CurColIndex +5;

				string EndCellRow  =EndRowIndex.ToString ();
				string EndCellCol  = null;

				if (EndColIndex<=26)
				{
					char  col = (char)(EndColIndex+'A'-1);
					EndCellCol=col.ToString ();
				}

				else if (CurColIndex>26&&CurColIndex<=260)
				{
					int FirstCha = CurColIndex/26;
					char FirstCharacter = (char)(FirstCha+'A'-1);
					int SecondCha =CurColIndex%2 ;
					char SecondChatacter = (char)(SecondCha+'A'-1);
					EndCellCol=FirstCharacter.ToString ()+SecondChatacter.ToString ();
				}

				endCell = this.TableName +"."+EndCellCol+EndCellRow;
				chart.EndCellAddress =endCell;
			}

			Cell   cell = (chart.GetCellPos (cellName,this)).cell ;
			cell.Content .Add (chart.Frame );
		}

Usage Example

		public  void CreateNewChart()
			
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=1; i++)
			{
				for(int j=1; j<=6;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					table.InsertCellAt (i, j, cell);
				}
			}
			
			Chart chart=ChartBuilder.CreateChartByAxisName
				(table,ChartTypes.bar ,"A1:E4","years","dollars");
			Assert.AreEqual(7, table.Rows[1].Cells.Count);
			Assert.AreEqual(6, table.Rows[2].Cells.Count);
			Assert.AreEqual(6, table.Rows[3].Cells.Count);
			Assert.AreEqual(6, table.Rows[4].Cells.Count);
			/*Chart chart = new Chart (table,"ch1");
			chart.ChartType=ChartTypes.bar .ToString () ;
			chart.XAxisName ="yeer";
			chart.YAxisName ="dollar";
			chart.CreateFromCellRange ("A1:E4");
			chart.EndCellAddress ="tab1.K17";*/
			table.InsertChartAt ("G2",chart);
			
			doc.Content .Add (table);
			doc.SaveTo(Path.Combine(AARunMeFirstAndOnce.outPutFolder, @"NewChartOne.ods"));
		}
All Usage Examples Of AODL.Document.Content.Tables.Table::InsertChartAt