ReadLabelFontSize ( ExcelTableReader.ExcelTableRow oRow, FontSizeConverter oFontSizeConverter, IEdge oEdge ) { Debug.Assert(oRow != null); Debug.Assert(oFontSizeConverter != null); AssertValid(); String sLabelFontSize; if (!oRow.TryGetNonEmptyStringFromCell( EdgeTableColumnNames.LabelFontSize, out sLabelFontSize)) { return; } Single fLabelFontSize; if (!Single.TryParse(sLabelFontSize, out fLabelFontSize)) { Range oInvalidCell = oRow.GetRangeForCell( EdgeTableColumnNames.LabelFontSize); OnWorkbookFormatError(String.Format( "The cell {0} contains an invalid label font size. The label" + " font size, which is optional, must be a number. Any" + " number is acceptable, although {1} is used for any number" + " less than {1} and {2} is used for any number greater than" + " {2}." , ExcelUtil.GetRangeAddress(oInvalidCell), FontSizeConverter.MinimumFontSizeWorkbook, FontSizeConverter.MaximumFontSizeWorkbook ), oInvalidCell ); } oEdge.SetValue(ReservedMetadataKeys.PerEdgeLabelFontSize, oFontSizeConverter.WorkbookToGraph(fLabelFontSize)); }
btnOK_Click ( object sender, EventArgs e ) { AssertValid(); if (!DoDataExchange(true)) { return; } // If the caller is going to force the workbook to be reread, there // is no point in editing the edges' metadata. if (!m_oEditedEdgeAttributes.WorkbookMustBeReread) { this.UseWaitCursor = true; EdgeWidthConverter oEdgeWidthConverter = new EdgeWidthConverter(); EdgeStyleConverter oEdgeStyleConverter = new EdgeStyleConverter(); AlphaConverter oAlphaConverter = new AlphaConverter(); FontSizeConverter oFontSizeConverter = new FontSizeConverter(); foreach (IEdge oEdge in m_oNodeXLControl.SelectedEdges) { SetValue <Color>(oEdge, ReservedMetadataKeys.PerColor, m_oEditedEdgeAttributes.Color); SetSingleValue(oEdge, ReservedMetadataKeys.PerEdgeWidth, m_oEditedEdgeAttributes.Width, oEdgeWidthConverter); SetValue <EdgeStyle>(oEdge, ReservedMetadataKeys.PerEdgeStyle, m_oEditedEdgeAttributes.Style); SetSingleValue(oEdge, ReservedMetadataKeys.PerAlpha, m_oEditedEdgeAttributes.Alpha, oAlphaConverter); if (m_oEditedEdgeAttributes.Visibility.HasValue) { Debug.Assert(m_oEditedEdgeAttributes.Visibility.Value == EdgeWorksheetReader.Visibility.Hide); oEdge.SetValue(ReservedMetadataKeys.Visibility, VisibilityKeyValue.Hidden); } SetStringValue(oEdge, ReservedMetadataKeys.PerEdgeLabel, m_oEditedEdgeAttributes.Label); SetValue <Color>(oEdge, ReservedMetadataKeys.PerEdgeLabelTextColor, m_oEditedEdgeAttributes.LabelTextColor); if (m_oEditedEdgeAttributes.LabelFontSize.HasValue) { oEdge.SetValue(ReservedMetadataKeys.PerEdgeLabelFontSize, oFontSizeConverter.WorkbookToGraph( m_oEditedEdgeAttributes.LabelFontSize.Value)); } } m_oNodeXLControl.DrawGraph(); this.UseWaitCursor = false; } DialogResult = DialogResult.OK; this.Close(); }
ReadLabelFontSize ( ExcelTableReader.ExcelTableRow oRow, FontSizeConverter oFontSizeConverter, IEdge oEdge ) { Debug.Assert(oRow != null); Debug.Assert(oFontSizeConverter != null); AssertValid(); String sLabelFontSize; if ( !oRow.TryGetNonEmptyStringFromCell( EdgeTableColumnNames.LabelFontSize, out sLabelFontSize) ) { return; } Single fLabelFontSize; if ( !Single.TryParse(sLabelFontSize, out fLabelFontSize) ) { Range oInvalidCell = oRow.GetRangeForCell( EdgeTableColumnNames.LabelFontSize); OnWorkbookFormatError( String.Format( "The cell {0} contains an invalid label font size. The label" + " font size, which is optional, must be a number. Any" + " number is acceptable, although {1} is used for any number" + " less than {1} and {2} is used for any number greater than" + " {2}." , ExcelUtil.GetRangeAddress(oInvalidCell), FontSizeConverter.MinimumFontSizeWorkbook, FontSizeConverter.MaximumFontSizeWorkbook ), oInvalidCell ); } oEdge.SetValue(ReservedMetadataKeys.PerEdgeLabelFontSize, oFontSizeConverter.WorkbookToGraph(fLabelFontSize) ); }