Requisiti software Recensioni con MS Word - Come posso ottenere metriche in modo automatizzato?
-
22-08-2019 - |
Domanda
Diciamo che ho un documento dei requisiti in MS Word, e qualcun altro recensioni It una fornisce un elenco dei problemi trovato utilizzando la funzionalità "Revisioni".
C'è un modo per estrarre "quante grandi / piccoli problemi sono stati trovati durante la revisione?" utilizzando uno script automatico - per scopi metriche
CodeCollaborator ha qualche integrazione di MS Word, ma non sembra sapere come guardare Word dentro per estrarre i dati revisioni. Si lancia solo il documento.
Soluzione
ho fatto una volta scritto una macro di Word che estrae i commenti a un documento separato, siete invitati a provare adattare questo ai vostri scopi, se si hanno problemi quindi rispondere qui e vi posso dare una mano con le modifiche.
Public Sub PROCESS_COMMENTS()
Dim strReplaceText As String
Dim myPar As Paragraph
Dim strCurrentColumn As String
Dim i As Integer
Dim Com As Comment
Application.ScreenUpdating = False
' set the input and output docs.
Set inDoc = ActiveDocument
' check we have comments to process in the original document
If inDoc.Comments.Count < 1 Then
MsgBox "No comments in the document"
Exit Sub
End If
' comments exist so create new document
Set outDoc = Documents.Add
Set outRange = outDoc.Content
outDoc.Range.InsertAfter "List of Comments:"
outDoc.Paragraphs(outDoc.Paragraphs.Count).Style = outDoc.Styles("Heading 1")
outDoc.Range.InsertParagraphAfter
' cycle through comments, inserting them in the new document
' display the new document and refresh
outDoc.Activate
Application.ScreenRefresh
For Each Com In inDoc.Comments
outRange.InsertAfter "[" & Com.Author & " - " & Com.Initial & Com.Index & "] "
outDoc.Paragraphs(outDoc.Paragraphs.Count).Range.Font.Bold = True
outDoc.Range.InsertParagraphAfter
outRange.InsertAfter Com.Range.Text
outDoc.Paragraphs(outDoc.Paragraphs.Count).Range.Font.Bold = False
Set myRange = Com.Scope
outDoc.Range.InsertParagraphAfter
outDoc.Range.InsertParagraphAfter
Next
Application.ScreenUpdating = True
Set outDoc = ActiveDocument
End Sub