SPREADのセルに入力された値のふりがなを取得することはできますか?
対象製品
InputMan for Windows Forms 7.0J
詳細
IMEコンポーネントのふりがな取得機能は、SPREAD for Windows Forms 7.0Jのセルに対しても有効です。IMEコンポーネントのResultStringイベントでセルに入力された漢字のふりがなを取得し、別のセルに表示することができます。
なお、OutputModeプロパティのIntelligenceに該当する機能を実現することはできません。
※下記サンプルコードを実行するには、フォームにあらかじめSPREADとGcImeコンポーネントを配置します。
[Visual Basic]
[C#]
なお、OutputModeプロパティのIntelligenceに該当する機能を実現することはできません。
※下記サンプルコードを実行するには、フォームにあらかじめSPREADとGcImeコンポーネントを配置します。
[Visual Basic]
Private tmpstring As String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim textCell As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
FpSpread1.ActiveSheet.Columns(0).CellType = textCell
End Sub
Private Sub FpSpread1_Change(sender As Object, e As FarPoint.Win.Spread.ChangeEventArgs) Handles FpSpread1.Change
If e.Column = 0 Then
FpSpread1.ActiveSheet.Cells(e.Row, 1).Value = tmpstring
End If
End Sub
Private Sub FpSpread1_EditModeOn(sender As Object, e As EventArgs) Handles FpSpread1.EditModeOn
' GcTextBoxCellTypeセルの編集用コントロールにGcImeを関連付け
If TypeOf FpSpread1.EditingControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
tmpstring = FpSpread1.ActiveSheet.Cells(FpSpread1.ActiveSheet.ActiveRowIndex, 1).Text
Dim editor As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = FpSpread1.EditingControl
GcIme1.SetKanaMode(editor, GrapeCity.Win.Editors.KanaMode.KatakanaHalf)
GcIme1.SetCausesImeEvent(editor, True)
End If
End Sub
Private Sub GcIme1_ResultString(sender As Object, e As GrapeCity.Win.Editors.ResultStringEventArgs) Handles GcIme1.ResultString
If TypeOf e.SourceControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
Dim textBoxEditingControl As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = e.SourceControl
tmpstring = String.Concat(tmpstring, e.ReadString)
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim textCell As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
FpSpread1.ActiveSheet.Columns(0).CellType = textCell
End Sub
Private Sub FpSpread1_Change(sender As Object, e As FarPoint.Win.Spread.ChangeEventArgs) Handles FpSpread1.Change
If e.Column = 0 Then
FpSpread1.ActiveSheet.Cells(e.Row, 1).Value = tmpstring
End If
End Sub
Private Sub FpSpread1_EditModeOn(sender As Object, e As EventArgs) Handles FpSpread1.EditModeOn
' GcTextBoxCellTypeセルの編集用コントロールにGcImeを関連付け
If TypeOf FpSpread1.EditingControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
tmpstring = FpSpread1.ActiveSheet.Cells(FpSpread1.ActiveSheet.ActiveRowIndex, 1).Text
Dim editor As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = FpSpread1.EditingControl
GcIme1.SetKanaMode(editor, GrapeCity.Win.Editors.KanaMode.KatakanaHalf)
GcIme1.SetCausesImeEvent(editor, True)
End If
End Sub
Private Sub GcIme1_ResultString(sender As Object, e As GrapeCity.Win.Editors.ResultStringEventArgs) Handles GcIme1.ResultString
If TypeOf e.SourceControl Is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl Then
Dim textBoxEditingControl As GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl = e.SourceControl
tmpstring = String.Concat(tmpstring, e.ReadString)
End If
End Sub
[C#]
private string tmpstring;
private void Form1_Load(object sender, EventArgs e)
{
// GcTextBoxCellType型セルの設定
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType textCell = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
fpSpread1.ActiveSheet.Columns[0].CellType = textCell;
}
void fpSpread1_EditModeOn(object sender, EventArgs e)
{
// GcTextBoxCellTypeセルの編集用コントロールにGcImeを関連付け
if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
{
tmpstring = fpSpread1.ActiveSheet.Cells[fpSpread1.ActiveSheet.ActiveRowIndex, 1].Text;
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl editor = fpSpread1.EditingControl as GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl;
gcIme1.SetKanaMode(editor, GrapeCity.Win.Editors.KanaMode.KatakanaHalf);
gcIme1.SetCausesImeEvent(editor, true);
}
}
void gcIme1_ResultString(object sender, ResultStringEventArgs e)
{
if (e.SourceControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
{
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl textBoxEditingControl = e.SourceControl as GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl;
tmpstring = string.Concat(tmpstring, e.ReadString);
}
}
void fpSpread1_Change(object sender, FarPoint.Win.Spread.ChangeEventArgs e)
{
if (e.Column == 0)
{
fpSpread1.ActiveSheet.Cells[e.Row, 1].Value = tmpstring;
}
}
private void Form1_Load(object sender, EventArgs e)
{
// GcTextBoxCellType型セルの設定
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType textCell = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
fpSpread1.ActiveSheet.Columns[0].CellType = textCell;
}
void fpSpread1_EditModeOn(object sender, EventArgs e)
{
// GcTextBoxCellTypeセルの編集用コントロールにGcImeを関連付け
if (fpSpread1.EditingControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
{
tmpstring = fpSpread1.ActiveSheet.Cells[fpSpread1.ActiveSheet.ActiveRowIndex, 1].Text;
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl editor = fpSpread1.EditingControl as GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl;
gcIme1.SetKanaMode(editor, GrapeCity.Win.Editors.KanaMode.KatakanaHalf);
gcIme1.SetCausesImeEvent(editor, true);
}
}
void gcIme1_ResultString(object sender, ResultStringEventArgs e)
{
if (e.SourceControl is GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl)
{
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl textBoxEditingControl = e.SourceControl as GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxEditingControl;
tmpstring = string.Concat(tmpstring, e.ReadString);
}
}
void fpSpread1_Change(object sender, FarPoint.Win.Spread.ChangeEventArgs e)
{
if (e.Column == 0)
{
fpSpread1.ActiveSheet.Cells[e.Row, 1].Value = tmpstring;
}
}