Function CS_ExtractHighlightedWords() As Boolean Dim CS_objRange As Range Dim CS_NewDoc_Obj As Document Dim CS_CollectionObj As New Collection Set CS_objRange = Application.ActiveDocument.Range With CS_objRange.Find .Highlight = True Do While .Execute If CS_objRange.HighlightColorIndex = wdYellow Then On Error Resume Next CS_CollectionObj.Add CS_objRange.Text, CStr(CS_objRange.Text) 'Here we are avoiding the duplicate values to be stored in the collection using the key 'If any of the extracted word is being stored as duplicate key then program will through 457 error. On Error GoTo 0 End If Loop End With On Error Resume Next Set CS_NewDoc_Obj = Documents.Open(FileName:="F:\log.docx", AddToRecentFiles:=False, Visible:=False) 'Opening the new file to write the extracted words. On Error GoTo ErrHandler Dim collectionItem As Variant For Each collectionItem In CS_CollectionObj CS_NewDoc_Obj.Range.InsertAfter collectionItem & vbCr CS_objRange.Collapse 0 Next collectionItem CS_NewDoc_Obj.Save CS_NewDoc_Obj.Close Set CS_CollectionObj = Nothing CS_ExtractHighlightedWords = True lbl_Exit: Exit Function ErrHandler: CS_ExtractHighlightedWords = False Resume lbl_Exit End Function
While developing the web pages with inline HTML5 videos we often need to adjust the video width or height according the available space on the web page. Here is the solution to find that required height and width keeping the same aspect ratio of the video. You may go ahead and set video CSS property to width: 100% and height: auto but this will not give you any idea about how much height the video is going to take on the web page. Then the better approach would be setting the video height or width using Javascript. So, sometimes to adjust the width according to available height on the web page, it require to calculate the NEW WIDTH which you can set to your video as per available height. The same goes with Height as well. So here are the solutions to solve this problem. Here I am assuming the video is having 16:9 ratio, which would be a HD video with 1920px width and 1080px height. Now suppose I want my video to fit in the width of 1280px, then...
Comments
Post a Comment