Menu

 

Saturday, July 31, 2010

Refernceing Collection :- (L) Lanuages,Lines,List Entries , Listlevel,List paragraphs , List ,List Collection

VBA Code :-

For Each la In Languages
Msgbox la.NameLocal
Next la

C# Code :-

public void Lang()
{
Word.Languages la = ThisApplication.Languages;

foreach (Word.Language wl in la)
{
string strLocalName = wl.Name;
MessageBox.Show(strLocalName);
}
}

VBA Code :-

Dim objLines As Lines

Set objLines = ActiveDocument.ActiveWindow.Panes(1) _
.Pages(1).Rectangles(1).Lines

C# Code :-

public void ObjLines()
{
Word.Lines objLines = null;
objLines = ThisApplication.ActiveDocument.ActiveWindow.Panes[1].Pages[1].Rectangles[1].Lines;
}

VBA Code :-

Dim objRectangle As Rectangle
Dim objLines As Lines

Set objRectangle = ActiveDocument.ActiveWindow _
.Panes(1).Pages(1).Rectangles(1)

If objRectangle.RectangleType = wdTextRectangle Then _
Set objLines = objRectangle.Lines

C# Code :-

public void RectangleLines()
{
Word.Rectangle objRectangle = null;
Word.Lines objLines = null;
objRectangle = ThisApplication.ActiveDocument.ActiveWindow.Panes[1].Pages[1].Rectangles[1];


if (objRectangle.RectangleType == Microsoft.Office.Interop.Word.WdRectangleType
.wdTextRectangle)
{
objLines = objRectangle.Lines;
}
}

VBA Code :-

For Each le In _
ActiveDocument.FormFields("Drop1").DropDown.ListEntries
MsgBox le.Name
Next le

C# Code :-

public void formFileds()
{

object item = 1;

int i=1;
foreach ( Word.ListEntries listEntries in ThisApplication.ActiveDocument.FormFields.get_Item(ref item).DropDown.ListEntries )
{
object getName = i;
string strName = listEntries.get_Item(ref getName).Name;
i++;

}
}

VBA Code :-

Set myField = _
ActiveDocument.FormFields.Add(Range:=Selection.Range, _
Type:=wdFieldFormDropDown)
With myField.DropDown.ListEntries
.Add Name:="Red"
.Add Name:="Blue"
.Add Name:="Green"
End With

C# Code :-

public void AddFiledSample()
{
Word.Range wordSelection = ThisApplication.Selection.Range;

ThisApplication.ActiveDocument.FormFields.Add(wordSelection, Microsoft.Office.Interop.Word.WdFieldType.wdFieldFormDropDown).DropDown.ListEntries.Add("Red", ref missing);

ThisApplication.ActiveDocument.FormFields.Add(wordSelection, Microsoft.Office.Interop.Word.WdFieldType.wdFieldFormDropDown).DropDown.ListEntries.Add("Blue", ref missing);

ThisApplication.ActiveDocument.FormFields.Add(wordSelection, Microsoft.Office.Interop.Word.WdFieldType.wdFieldFormDropDown).DropDown.ListEntries.Add("Green", ref missing);



}

VBA Code :-

Set mytemp = ActiveDocument.ListTemplates(1)
For Each lev In mytemp.ListLevels
lev.NumberStyle = wdListNumberStyleLowercaseLetter
Next lev

C# Code :-

public void ListofTempltes()
{
object i = 1;

Word.ListTemplates myTemp = ThisApplication.ActiveDocument.ListTemplates;
foreach (Word.ListTemplates lev in myTemp.get_Item(ref i).ListLevels)
{

}

}

VBA Code :-

ActiveDocument.ListTemplates(1).ListLevels(1).StartAt = 4

C# Code :-

public void ListLevelStarts()
{
object objlevel = 1;
Word.ListLevels wl = ThisApplication.ActiveDocument.ListTemplates.get_Item(ref objlevel).ListLevels;
foreach (Word.ListLevel wlevel in wl)
{
wlevel.StartAt = 4;
}
}

VBA Code :-

For Each para in ActiveDocument.ListParagraphs
para.Range.HighlightColorIndex = wdTurquoise
Next para

C# code :-

public void ListParagraph()
{
Word.ListParagraphs wlps = ThisApplication.ActiveDocument.ListParagraphs;

foreach (Word.Paragraph wllps in wlps)
{
wllps.Range.HighlightColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdTurquoise;
}
}

VBA Code :-

For Each li In ActiveDocument.Lists
MsgBox li.CountNumberedItems
Next li

C# Code :-

public void ListsActive()
{
Word.Lists wordList = ThisApplication.ActiveDocument.Lists;

foreach (Word.List wrdlist in wordList)
{
string strCount =wrdlist.CountNumberedItems(ref missing, ref missing).ToString();
MessageBox.Show(strCount);
}
}

VBA Code :-

Set temp1 = ListGalleries(wdNumberGallery).ListTemplates(1)
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=temp1

C# Code :-

public void ListGallies()
{
object indexno =1;

Word.ListGalleries temp1 = ThisApplication.ListGalleries;
Word.ListTemplates wrdlstTemp = temp1[Microsoft.Office.Interop.Word.WdListGalleryType.wdNumberGallery].ListTemplates;

Word.ListTemplate wordtemp = wrdlstTemp.get_Item(ref indexno);

this.Application.ActiveDocument.Lists[2].ApplyListTemplate(wordtemp, ref missing, ref missing);


}

VBA Code :-

For Each lt In ActiveDocument.ListTemplates
MsgBox "This is a multiple-level list template - " _
& lt.OutlineNumbered
Next LT

C# Code :-

public void listTemplate()
{
Word.ListTemplates wrdTemps = ThisApplication.ActiveDocument.ListTemplates;

foreach (Word.Template wrdTemp in wrdTemps)
{
string strname = wrdTemp.Name;
}
}

VBA Code :-

Set myLT = ActiveDocument.ListTemplates.Add
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLT

C# Code :-

public void ActiveListtemo()
{
object numberline =4;
object name ="test";
ThisApplication.ActiveDocument.ListTemplates.Add(ref numberline, ref name);
}

No comments:

Post a Comment