10-12-21 05:52 PM
|
Name: |
Contact:
|
|
Address:
|
Landmark:
|
Answered! Go to Answer.
16-12-21 05:19 PM
doc.Tables.Item(TableNumber).Cell(Cell_X, Cell_Y).Range.Select instead of doc.Tables.Item(TableNumber).Cell(Cell_X, Cell_Y).Select
Const wdAlignParagraphLeft = 0Const wdAlignParagraphCenter = 1Const wdAlignParagraphRight = 2Const wdAlignParagraphJustify = 3Const wdAlignParagraphDistribute = 4Const wdAlignParagraphJustifyMed = 5Const wdAlignParagraphJustifyHi = 7Const wdAlignParagraphJustifyLow = 8Const wdAlignParagraphThaiJustify = 9Dim currentMode As Integer = -1Dim doc as Object = GetDocument(handle,documentname)
doc.Tables.Item(TableNumber).Cell(Cell_Y,Cell_X).Range.SelectSelect Case AlignmentMode.Trim.ToLower Case "center" currentMode = wdAlignParagraphCenter Case "distribute" currentMode = wdAlignParagraphDistribute Case "justify" currentMode = wdAlignParagraphJustify Case "justifyhi" currentMode = wdAlignParagraphJustifyHi Case "justifylow" currentMode = wdAlignParagraphJustifyLow Case "justifymed" currentMode = wdAlignParagraphJustifyMed Case "left" currentMode = wdAlignParagraphLeft Case "right" currentMode = wdAlignParagraphRight Case "justifythai" currentMode = wdAlignParagraphThaiJustify Case Else Throw New Exception("Invalid alignment mode has been supplied")End Selectdoc.ActiveWindow.Selection.ParagraphFormat.Alignment = currentMode10-12-21 09:46 PM
|
Name (X=1, Y=1) |
Address(X=1, Y=2) |
|
Contact(X=2, Y=1) |
Landmark(X=2, Y=2) |
|
Name(X=1, Y=1) |
Address(X=1, Y=2) |
|
(X=2, Y=1) |
(X=2, Y=2) |
|
Contact(X=3, Y=1) |
Landmark(X=3, Y=2) |
|
(X=4, Y=1) |
(X=4, Y=2) |
14-12-21 01:00 PM
Hi Devneet,
Thanks for your help. It resolved my query.
I am also getting stuck at few more areas-
1. After running 'Set Table Cell' action in 'MS Word VBO', the name appears as desired in the table in MS Word. But the name alignment shifts from center to left alignment. I want the name to again shift to center alignment. How can that be achieved ?
2. There are few checkboxes in the MS Word table. How can I check them Yes or No ? Y/N boxes are such that, as I will click on box of Yes or No, then it will get checked.
|
Does customer have passport? |
☐Y ☐ N |
ABC |
☐Y ☐ N ☐ N/A |
|
Documents ? |
☐Y ☐ N |
XYZ |
☐Y ☐ N |
14-12-21 05:05 PM
Refer to the below workflow for more information:
Now, add a custom code stage with the following Input parameters and the code as shown below. No output parameters are required:
Code:Const wdContentControlCheckBox = 8Dim d As Object = GetDocument(handle,document_name)Dim success As Boolean = FalseIf use_index = False Then For Each ctrl In d.ContentControls If ctrl.Type = wdContentControlCheckBox And ctrl.Tag = tag_name Then ctrl.Checked = check_mode success = True End If Next If Not success Then Throw New Exception("No form control of checkbox type was found with the supplied tag name") End IfElse If d.ContentControls(index).Type = wdContentControlCheckBox Then d.ContentControls(index).Checked = check_mode Else Throw New Exception("The form control located at the supplied index is not of checkbox type") End IfEnd If
You can publish this action and run the same from Process Studio to check your results.
Some of the test results are shown below:
Scenario 1: For the input file having both the checkboxes as unselected, using index based search for selecting "No" checkbox (index=2)
Result of the action is:
Scenario 2: For the input file having the "No" checkboxes as selected, using tag name based search for deselecting "No" checkbox (tag Name= "No")
Result of the action is:
Let us know if it help and do mark the solution as the best answer if it resolves your query
15-12-21 04:21 PM
15-12-21 06:41 PM
Const wdAlignParagraphLeft = 0Const wdAlignParagraphCenter = 1Const wdAlignParagraphRight = 2Const wdAlignParagraphJustify = 3Const wdAlignParagraphDistribute = 4Const wdAlignParagraphJustifyMed = 5Const wdAlignParagraphJustifyHi = 7Const wdAlignParagraphJustifyLow = 8Const wdAlignParagraphThaiJustify = 9Dim currentMode As Integer = -1Dim doc as Object = GetDocument(handle,documentname)
doc.Tables.Item(TableNumber).SelectSelect Case AlignmentMode.Trim.ToLower Case "center" currentMode = wdAlignParagraphCenter Case "distribute" currentMode = wdAlignParagraphDistribute Case "justify" currentMode = wdAlignParagraphJustify Case "justifyhi" currentMode = wdAlignParagraphJustifyHi Case "justifylow" currentMode = wdAlignParagraphJustifyLow Case "justifymed" currentMode = wdAlignParagraphJustifyMed Case "left" currentMode = wdAlignParagraphLeft Case "right" currentMode = wdAlignParagraphRight Case "justifythai" currentMode = wdAlignParagraphThaiJustify Case Else Throw New Exception("Invalid alignment mode has been supplied")End Selectdoc.ActiveWindow.Selection.ParagraphFormat.Alignment = currentMode16-12-21 06:28 AM
16-12-21 06:39 AM
doc.Tables.Item(TableNumber).Select to doc.Tables.Item(TableNumber).Cell(Cell_X, Cell_Y).Select
This will only select the cell in that table which needs to be aligned as per the X and Y value you provide. 16-12-21 12:01 PM
16-12-21 05:19 PM
doc.Tables.Item(TableNumber).Cell(Cell_X, Cell_Y).Range.Select instead of doc.Tables.Item(TableNumber).Cell(Cell_X, Cell_Y).Select
Const wdAlignParagraphLeft = 0Const wdAlignParagraphCenter = 1Const wdAlignParagraphRight = 2Const wdAlignParagraphJustify = 3Const wdAlignParagraphDistribute = 4Const wdAlignParagraphJustifyMed = 5Const wdAlignParagraphJustifyHi = 7Const wdAlignParagraphJustifyLow = 8Const wdAlignParagraphThaiJustify = 9Dim currentMode As Integer = -1Dim doc as Object = GetDocument(handle,documentname)
doc.Tables.Item(TableNumber).Cell(Cell_Y,Cell_X).Range.SelectSelect Case AlignmentMode.Trim.ToLower Case "center" currentMode = wdAlignParagraphCenter Case "distribute" currentMode = wdAlignParagraphDistribute Case "justify" currentMode = wdAlignParagraphJustify Case "justifyhi" currentMode = wdAlignParagraphJustifyHi Case "justifylow" currentMode = wdAlignParagraphJustifyLow Case "justifymed" currentMode = wdAlignParagraphJustifyMed Case "left" currentMode = wdAlignParagraphLeft Case "right" currentMode = wdAlignParagraphRight Case "justifythai" currentMode = wdAlignParagraphThaiJustify Case Else Throw New Exception("Invalid alignment mode has been supplied")End Selectdoc.ActiveWindow.Selection.ParagraphFormat.Alignment = currentMode