Menu

 

Friday, August 6, 2010

Refernce Collection :- (R) Readability Statics, RecentFiles,Rectangle,Reviews,Revisons,Rows

VBA Code :-

For each rs in Selection.Range.ReadabilityStatistics
Msgbox rs.Name & " - " & rs.Value
Next rs

Set myRange = ActiveDocument.Content
wordval = myRange.ReadabilityStatistics(1).Value
Msgbox wordval

C# Code :-

public void ReadabilityStatics()
{
Word.ReadabilityStatistics wordReadStatics = ThisApplication.Selection.Range.ReadabilityStatistics;

foreach (Word.ReadabilityStatistic wordRead in wordReadStatics)
{
string strName = "";
strName = wordRead.Name;
float strValue ;
strValue = wordRead.Value;

}

VBA Code :-

RecentFiles.Maximum = 5
*
If ActiveDocument.Saved = True Then
RecentFiles.Add Document:=ActiveDocument.FullName, _
ReadOnly:=True
End If

*
If RecentFiles.Count >= 1 Then RecentFiles(1).Open

C# Code :-

public void RecentFiles()
{
ThisApplication.RecentFiles.Maximum = 5;

if (ThisApplication.ActiveDocument.Saved == true)
{
object document = ThisApplication.ActiveDocument.FullName;
object ReadOnly = true;
ThisApplication.RecentFiles.Add(ref document, ref ReadOnly);
}

if (ThisApplication.RecentFiles.Count >= 1)
{
ThisApplication.RecentFiles[1].Open();
}
}

VBA Code :-

Dim objRectangles As Rectangles

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

C# Code :-

public void Rectanges()
{
Word.Rectangles wordRect = ThisApplication.ActiveDocument.ActiveWindow.Panes[1].Pages[1].Rectangles;
}

VBA Code :-

Sub HideAuthorRevisions(blnRev As Boolean)
ActiveWindow.View.Reviewers(Index:=1) _
.Visible = False
End Sub

C# Code :-

public void hideAutorRevesion()
{
object objectvalue = 1;

ThisApplication.ActiveWindow.View.Reviewers.get_Item(ref objectvalue).Visible = false;
}

VBA Code :-

MsgBox ActiveDocument.Revisions.Count
*
For Each myRev In Selection.Range.Revisions
myRev.Accept
Next myRev
*
Set myRange = Selection.Paragraphs(1).Range
myRange.Revisions.AcceptAll
*
ActiveDocument.TrackRevisions = True
Selection.InsertBefore "The "
*
MsgBox ActiveDocument.Sections(1).Range.Revisions(1).Author

C# Code

public void Revisions()
{
int revCount = ThisApplication.ActiveDocument.Revisions.Count;

Word.Revisions wordRevesions = ThisApplication.Selection.Range.Revisions;

foreach (Word.Revision wordRev in wordRevesions)
{
wordRev.Accept();
}

Word.Range wordRange = ThisApplication.Selection.Paragraphs[1].Range;
wordRange.Revisions.AcceptAll();

ThisApplication.ActiveDocument.TrackRevisions = true;
string strInsertBefore = "The ";
ThisApplication.Selection.InsertBefore(strInsertBefore);

string strAutName = "";
strAutName = ThisApplication.ActiveDocument.Sections[1].Range.Revisions[1].Author;


}

VBA Code :-

ActiveDocument.Tables(1).Rows.Alignment = wdAlignRowCenter
*
If Selection.Information(wdWithInTable) = True Then
Selection.Rows.Add BeforeRow:=Selection.Rows(1)
End If

C# Code :-
public void RowAligment()
{
ThisApplication.ActiveDocument.Tables[1].Rows.Alignment = Microsoft.Office.Interop.Word.WdRowAlignment.wdAlignRowCenter;
bool isTable =(bool)ThisApplication.Selection.get_Information(Microsoft.Office.Interop.Word.WdInformation.wdWithInTable);
if (isTable)
{
object before = 1;
ThisApplication.Selection.Rows.Add(ref before);

}
}

1 comment:

  1. You've saved me hours of work. Thanks for taking the time to document this work.

    Only one question (I'm pretty new at this stuff), where does "ThisApplication" come from??

    Thanks

    chuck Snyder

    ReplyDelete