如何检查 Star Basic 中损坏的内部链接?

2024-02-16

我正在为 LibreOffice Writer 创建一个基本宏来检查损坏的内部链接。简而言之:

  • 生成所有锚点的列表
  • 循环浏览文档,查找内部超链接
  • 如果内部超链接不在锚点列表中,则打开它进行编辑(然后停止)

我的代码有一些未解决的问题:

  1. (within fnBuildAnchorList)我们如何获得每个标题的编号?例如,如果第一个 1 级标题文本是“Introduction”,则正确的锚点是#1.Introduction|outline我们正在录制Introduction|outline
  2. (within subInspectLink)我们如何正确测试标题的超链接?我注意到,当我手动点击标题链接时,当编号相同时就会成功,but also当文本相同时。
    例如如果有内部链接#1.My first heading|outline,可以通过超链接到达#1.Previous header name|outline but also与超链接#2.3.5.My first heading|outline
  3. (within subInspectLink)我们如何打开一个specific用于编辑的超链接?我们是否将参数传递给.uno:EditHyperlink?我们移动光标吗? (我发现的所有动作都是相对的,例如.uno:GoRight)我们使用文本部分吗?.Start and .End特性?
REM  *****  BASIC  *****
Option Explicit


' PrintArray displays a MsgBox with the whole array
' for DEBUG purposes only
Sub subPrintArray(sTitle as String, theArray() as String)
    Dim sArray
    sArray = sTitle & ":" & Chr(13) & Join(theArray,Chr(13))
    MsgBox(sArray, 64, "***DEBUG")
End sub

' auxiliary sub for BuildAnchorList
Sub subAddItemToAnchorList (oAnchors() as String, sTheAnchor as String, sType as String)
    Dim sAnchor
    Select Case sType
        Case "Heading":
            sAnchor = sTheAnchor + "|outline"
        Case "Table":
            sAnchor = sTheAnchor + "|table"
        Case "Text Frame":
            sAnchor = sTheAnchor + "|frame"
        Case "Image":
            sAnchor = sTheAnchor + "|graphic"
        Case "Object":
            sAnchor = sTheAnchor + "|ole"
        Case "Section":
            sAnchor = sTheAnchor + "|region"
        Case "Bookmark":
            sAnchor = sTheAnchor
    End Select
    ReDim Preserve oAnchors(UBound(oAnchors)+1) as String
    oAnchors(UBound(oAnchors)) = sAnchor
End Sub

' auxiliary sub for BuildAnchorList
Sub subAddArrayToAnchorList (oAnchors() as String, oNewAnchors() as String, sType as String)
    Dim i, iStart, iStop
    iStart = LBound(oNewAnchors)
    iStop = UBound(oNewAnchors)
    If iStop < iStart then Exit Sub ' empty array, nothing to do
    For i = iStart to iStop
        subAddItemToAnchorList (oAnchors, oNewAnchors(i), sType)
    Next
End Sub

Function fnBuildAnchorList()
    Dim oDoc as Object, oAnchors() as String
    oDoc = ThisComponent

    ' get the whole document outline
    Dim oParagraphs, thisPara, oTextPortions, thisPortion
    oParagraphs = oDoc.Text.createEnumeration ' all the paragraphs
    Do While oParagraphs.hasMoreElements
        thisPara = oParagraphs.nextElement
        If thisPara.ImplementationName = "SwXParagraph" then ' is a paragraph
            If thisPara.OutlineLevel>0 Then ' is a heading
                ' ***
                ' *** TO DO: How do we get the numbering for each heading?
                ' For example, if the first level 1 heading text is “Introduction”,
                ' the correct anchor is `#1.Introduction|outline`
                ' and we are recording `Introduction|outline`
                ' ***
                subAddItemToAnchorList (oAnchors, thisPara.String, "Heading")
            End if
        End if
    Loop
    ' text tables, text frames, images, objects, bookmarks and text sections
    subAddArrayToAnchorList(oAnchors, oDoc.getTextTables().ElementNames, "Table")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextFrames().ElementNames, "Text Frame")
    subAddArrayToAnchorList(oAnchors, oDoc.getGraphicObjects().ElementNames, "Image")
    subAddArrayToAnchorList(oAnchors, oDoc.getEmbeddedObjects().ElementNames, "Object")
    subAddArrayToAnchorList(oAnchors, oDoc.Bookmarks.ElementNames, "Bookmark")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextSections().ElementNames, "Section")

    fnBuildAnchorList = oAnchors
End Function

Function fnIsInArray( theString as String, theArray() as String )
    Dim i as Integer, iStart as Integer, iStop as Integer
    iStart = LBound(theArray)
    iStop = UBound(theArray)
    If iStart<=iStop then
        For i = iStart to iStop
            If theString = theArray(i) then
                fnIsInArray = True
                Exit function
            End if
        Next
    End if
    fnIsInArray = False
End function

Function fnIsOutlineInArray ( theString as String, theArray() as String )
    Dim i as Integer
    For i = LBound(theArray) to UBound(theArray)
        If theArray(i) = Right(theString,Len(theArray(i))) then
            fnIsOutlineInArray = True
            Exit function
        End if
    Next
    fnIsOutlineInArray = False
End function

' auxiliary function to FindBrokenInternalLinks
' inspects any links inside the current document fragment
' used to have an enumeration inside an enumeration, per OOo examples,
' but tables don't have .createEnumeration
Sub subInspectLinks( oAnchors as Object, oFragment as Object, iFragments as Integer, iLinks as Integer )
    Dim sMsg, sImplementation, thisPortion
    sImplementation = oFragment.implementationName
    Select Case sImplementation

        Case "SwXParagraph":
            ' paragraphs can be enumerated
            Dim oParaPortions, sLink, notFound
            oParaPortions = oFragment.createEnumeration
            ' go through all the text portions in current paragraph
            While oParaPortions.hasMoreElements
                thisPortion = oParaPortions.nextElement
                iFragments = iFragments + 1
                If Left(thisPortion.HyperLinkURL, 1) = "#" then
                    ' internal link found: get it all except initial # character
                    iLinks = iLinks + 1
                    sLink = right(thisPortion.HyperLinkURL, Len(thisPortion.HyperLinkURL)-1)
                    If Left(sLink,14) = "__RefHeading__" then
                        ' link inside a table of contents, no need to check
                        notFound = False
                    Elseif Right(sLink,8) = "|outline" then
                        ' special case for outline: since we don't know how to get the
                        ' outline numbering, we have to match the right most part of the
                        ' link only
                        notFound = not fnIsOutlineInArray(sLink, oAnchors)
                    Else
                        notFound = not fnIsInArray(sLink, oAnchors)
                    End if
                    If notFound then
                        ' anchor not found
                        ' *** DEBUG: code below up to MsgBox
                        sMsg = "Fragment #" & iFragments & ", internal link #" & iLinks & Chr(13) _
                            & "Bad link: [" & thisPortion.String & "] -> [" _
                            & thisPortion.HyperLinkURL & "] " & Chr(13) _
                            & "Paragraph:" & Chr(13) & oFragment.String & Chr(13) _
                            & "OK to continue, Cancel to stop"
                        Dim iChoice as Integer
                        iChoice = MsgBox (sMsg, 48+1, "Find broken internal link")
                        If iChoice = 2 Then End
                        ' ***
                        ' *** TO DO: How do we open a _specific_ hyperlink for editing?
                        ' Do we pass parameters to `.uno:EditHyperlink`?
                        ' Do we move the cursor? (Except all moves I found were relative,
                        ' e.g. `.uno:GoRight`)
                        ' Do we use the text portion’s `.Start` and `.End` properties?
                        ' ***
                    End If
                End if
            Wend
            ' *** END paragraph

        Case "SwXTextTable":
            ' text tables have cells
            Dim i, eCells, thisCell, oCellPortions
            eCells = oFragment.getCellNames()
            For i = LBound(eCells) to UBound(eCells)
                thisCell = oFragment.getCellByName(eCells(i))
                oCellPortions = thisCell.createEnumeration
                    While oCellPortions.hasMoreElements
                        thisPortion = oCellPortions.nextElement
                        iFragments = iFragments + 1
                        ' a table cell may contain a paragraph or another table,
                        ' so call recursively
                        subInspectLinks (oAnchors, thisPortion, iFragments, iLinks)
                    Wend
'               xray thisPortion
                'SwXCell has .String
            Next
            ' *** END text table

        Case Else
            sMsg = "Implementation method '" & sImplementation & "' not covered by regular code." _
                & "OK to continue, Cancel to stop"
            If 2 = MsgBox(sMsg, 48+1) then End
            ' uses xray for element inspection; if not available, comment the two following lines
            BasicLibraries.loadLibrary("XrayTool")
            xray oFragment
            ' *** END unknown case

    End Select
End sub

Sub FindBrokenInternalLinks
    ' Find the next broken internal link
    '
    ' Pseudocode:
    '
    ' * generate link of anchors - *** TO DO: prefix the outline numbering for headings
    ' * loop, searching for internal links
    '     - is the internal link in the anchor list?
    '         * Yes: continue to next link
    '         * No: (broken link found)
    '             - select that link text - *** TO DO: cannot select it
    '             - open link editor so user can fix this
    '             - stop
    ' * end loop
    ' * display message "No bad internal links found"

    Dim oDoc as Object, oFragments as Object, thisFragment as Object
    Dim iFragments as Integer, iLinks as Integer, sMsg as String
    Dim oAnchors() as String ' list of all anchors in the document
'   Dim sMsg ' for MsgBox

    oDoc = ThisComponent

    ' get all document anchors
    oAnchors = fnBuildAnchorList()
'   subPrintArray("Anchor list", oAnchors) ' *** DEBUG ***
'   MsgBox( UBound(oAnchors)-LBound(oAnchors)+1 & " anchors found – stand by for checking")

    ' find links    
    iFragments = 0 ' fragment counter
    iLinks = 0     ' internal link counter
    oFragments = oDoc.Text.createEnumeration ' has all the paragraphs
    While oFragments.hasMoreElements
        thisFragment = oFragments.nextElement
        iFragments = iFragments + 1
        subInspectLinks (oAnchors, thisFragment, iFragments, iLinks)
    Wend
    If iLinks then
        sMsg = iLinks & " internal links found, all good"
    Else
        sMsg = "This document has no internal links"
    End if
    MsgBox (sMsg, 64, "Find broken internal link")

End Sub

' *** END FindBrokenInternalLinks ***

您可以使用任何带有标题的文档来检查第一期 - 将弹出一个包含所有锚点的消息框,您将看到缺少的大纲编号。

第二个问题需要一个内部链接错误的文档。


查看cOOol http://free-electrons.com/blog/coool/。你可以使用这个 而不是创建宏, 或者从代码中借用一些概念。

测试链接(可能使用.uno:JumpToMark)似乎没有帮助, 因为内部链接总是会去某处即使目标不存在。 相反,按照您的建议构建有效目标的列表。

为了保存有效目标的列表,cOOol 代码使用 Python 集。 如果你想使用Basic,那么数据结构就受到更多限制。 但是,可以通过声明一个新的 a 来完成收藏 https://msdn.microsoft.com/en-us/library/aa231021(v=vs.60).aspx目的 或者通过使用基本数组,也许可以使用ReDim.

另请查看 cOOol 代码如何定义有效的目标字符串。例如:

internal_targets.add('0.' * heading_level + data + '|outline')            

要打开超链接对话框,请选择超链接文本,然后调用:

dispatcher.executeDispatch(document, ".uno:EditHyperlink", "", 0, Array())

EDIT:

好的,我为此工作了几个小时并得出了以下代码:

REM  *****  BASIC  *****
Option Explicit


' PrintArray displays a MsgBox with the whole array
' for DEBUG purposes only
Sub subPrintArray(sTitle as String, theArray() as String)
    Dim sArray
    sArray = sTitle & ":" & Chr(13) & Join(theArray,Chr(13))
    MsgBox(sArray, 64, "***DEBUG")
End sub

' auxiliary sub for BuildAnchorList
Sub subAddItemToAnchorList (oAnchors() as String, sTheAnchor as String, sType as String)
    Dim sAnchor
    Select Case sType
        Case "Heading":
            sAnchor = sTheAnchor + "|outline"
        Case "Table":
            sAnchor = sTheAnchor + "|table"
        Case "Text Frame":
            sAnchor = sTheAnchor + "|frame"
        Case "Image":
            sAnchor = sTheAnchor + "|graphic"
        Case "Object":
            sAnchor = sTheAnchor + "|ole"
        Case "Section":
            sAnchor = sTheAnchor + "|region"
        Case "Bookmark":
            sAnchor = sTheAnchor
    End Select
    ReDim Preserve oAnchors(UBound(oAnchors)+1) as String
    oAnchors(UBound(oAnchors)) = sAnchor
End Sub

' auxiliary sub for BuildAnchorList
Sub subAddArrayToAnchorList (oAnchors() as String, oNewAnchors() as String, sType as String)
    Dim i, iStart, iStop
    iStart = LBound(oNewAnchors)
    iStop = UBound(oNewAnchors)
    If iStop < iStart then Exit Sub ' empty array, nothing to do
    For i = iStart to iStop
        subAddItemToAnchorList (oAnchors, oNewAnchors(i), sType)
    Next
End Sub

' Updates outlineLevels for the current level.
' Returns a string like "1.2.3"
Function fnGetOutlinePrefix(outlineLevel as Integer, outlineLevels() as Integer)
    Dim level as Integer, prefix as String
    outlineLevels(outlineLevel) = outlineLevels(outlineLevel) + 1
    For level = outlineLevel + 1 to 9
        ' Reset all lower levels.
        outlineLevels(level) = 0
    Next
    prefix = ""
    For level = 0 To outlineLevel
        prefix = prefix & outlineLevels(level) & "."
    Next
    fnGetOutlinePrefix = prefix
End Function

Function fnBuildAnchorList()
    Dim oDoc as Object, oAnchors() as String, anchorName as String
    Dim level as Integer, levelCounter as Integer
    Dim outlineLevels(10) as Integer
    For level = 0 to 9
        outlineLevels(level) = 0
    Next
    oDoc = ThisComponent

    ' get the whole document outline
    Dim oParagraphs, thisPara, oTextPortions, thisPortion
    oParagraphs = oDoc.Text.createEnumeration ' all the paragraphs
    Do While oParagraphs.hasMoreElements
        thisPara = oParagraphs.nextElement
        If thisPara.ImplementationName = "SwXParagraph" then ' is a paragraph
            If thisPara.OutlineLevel>0 Then ' is a heading
                level = thisPara.OutlineLevel - 1
                anchorName = fnGetOutlinePrefix(level, outlineLevels) & thisPara.String
                subAddItemToAnchorList (oAnchors, anchorName, "Heading")
            End if
        End if
    Loop
    ' text tables, text frames, images, objects, bookmarks and text sections
    subAddArrayToAnchorList(oAnchors, oDoc.getTextTables().ElementNames, "Table")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextFrames().ElementNames, "Text Frame")
    subAddArrayToAnchorList(oAnchors, oDoc.getGraphicObjects().ElementNames, "Image")
    subAddArrayToAnchorList(oAnchors, oDoc.getEmbeddedObjects().ElementNames, "Object")
    subAddArrayToAnchorList(oAnchors, oDoc.Bookmarks.ElementNames, "Bookmark")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextSections().ElementNames, "Section")

    fnBuildAnchorList = oAnchors
End Function

Function fnIsInArray( theString as String, theArray() as String )
    Dim i as Integer
    For i = LBound(theArray()) To UBound(theArray())
        If theString = theArray(i) Then
            fnIsInArray = True
            Exit function
        End if
    Next
    fnIsInArray = False
End function

' Open a _specific_ hyperlink for editing.
Sub subEditHyperlink(textRange as Object)
    Dim document As Object
    Dim dispatcher As Object
    Dim oVC As Object

    oVC = ThisComponent.getCurrentController().getViewCursor()
    oVC.gotoRange(textRange.getStart(), False)
    document = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:EditHyperlink", "", 0, Array())
End Sub

' auxiliary function to FindBrokenInternalLinks
' inspects any links inside the current document fragment
' used to have an enumeration inside an enumeration, per OOo examples,
' but tables don't have .createEnumeration
Sub subInspectLinks(oAnchors() as String, oFragment as Object, iFragments as Integer, iLinks as Integer, iBadLinks as Integer)
    Dim sMsg, sImplementation, thisPortion
    sImplementation = oFragment.implementationName
    Select Case sImplementation

        Case "SwXParagraph":
            ' paragraphs can be enumerated
            Dim oParaPortions, sLink, notFound
            oParaPortions = oFragment.createEnumeration
            ' go through all the text portions in current paragraph
            While oParaPortions.hasMoreElements
                thisPortion = oParaPortions.nextElement
                iFragments = iFragments + 1
                If Left(thisPortion.HyperLinkURL, 1) = "#" then
                    ' internal link found: get it all except initial # character
                    iLinks = iLinks + 1
                    sLink = right(thisPortion.HyperLinkURL, Len(thisPortion.HyperLinkURL)-1)
                    If Left(sLink,14) = "__RefHeading__" then
                        ' link inside a table of contents, no need to check
                        notFound = False
                    Else
                        notFound = not fnIsInArray(sLink, oAnchors)
                    End if
                    If notFound then
                        ' anchor not found
                        ' *** DEBUG: code below up to MsgBox
                        iBadLinks = iBadLinks + 1
                        sMsg = "Fragment #" & iFragments & ", internal link #" & iLinks & Chr(13) _
                            & "Bad link: [" & thisPortion.String & "] -> [" _
                            & thisPortion.HyperLinkURL & "] " & Chr(13) _
                            & "Paragraph:" & Chr(13) & oFragment.String & Chr(13) _
                            & "Yes to edit link, No to continue, Cancel to stop"
                        Dim iChoice as Integer
                        iChoice = MsgBox (sMsg, MB_YESNOCANCEL + MB_ICONEXCLAMATION, _
                            "Find broken internal link")
                        If iChoice = IDCANCEL Then
                            End
                        ElseIf iChoice = IDYES Then
                            subEditHyperlink(thisPortion)
                        End If
                    End If
                End if
            Wend
            ' *** END paragraph

        Case "SwXTextTable":
            ' text tables have cells
            Dim i, eCells, thisCell, oCellPortions
            eCells = oFragment.getCellNames()
            For i = LBound(eCells) to UBound(eCells)
                thisCell = oFragment.getCellByName(eCells(i))
                oCellPortions = thisCell.createEnumeration
                    While oCellPortions.hasMoreElements
                        thisPortion = oCellPortions.nextElement
                        iFragments = iFragments + 1
                        ' a table cell may contain a paragraph or another table,
                        ' so call recursively
                        subInspectLinks (oAnchors, thisPortion, iFragments, iLinks)
                    Wend
'               xray thisPortion
                'SwXCell has .String
            Next
            ' *** END text table

        Case Else
            sMsg = "Implementation method '" & sImplementation & "' not covered by regular code." _
                & "OK to continue, Cancel to stop"
            If 2 = MsgBox(sMsg, 48+1) then End
            ' uses xray for element inspection; if not available, comment the two following lines
            BasicLibraries.loadLibrary("XrayTool")
            xray oFragment
            ' *** END unknown case

    End Select
End sub

Sub FindBrokenInternalLinks
    ' Find the next broken internal link
    '
    ' Pseudocode:
    '
    ' * generate link of anchors - *** TO DO: prefix the outline numbering
    ' *  for headings loop, searching for internal links
    '     - is the internal link in the anchor list?
    '         * Yes: continue to next link
    '         * No: (broken link found)
    '             - select that link text - *** TO DO: cannot select it
    '             - open link editor so user can fix this
    '             - stop
    ' * end loop
    ' * display message "No bad internal links found"

    Dim oDoc as Object, oFragments as Object, thisFragment as Object
    Dim iFragments as Integer, iLinks as Integer, iBadLinks as Integer, sMsg as String
    Dim oAnchors() as String ' list of all anchors in the document

    oDoc = ThisComponent

    ' get all document anchors
    oAnchors = fnBuildAnchorList()
'   subPrintArray("Anchor list", oAnchors) ' *** DEBUG ***
'   MsgBox( UBound(oAnchors)-LBound(oAnchors)+1 & " anchors found – stand by for checking")

    ' find links    
    iFragments = 0 ' fragment counter
    iLinks = 0     ' internal link counter
    iBadLinks = 0
    oFragments = oDoc.Text.createEnumeration ' has all the paragraphs
    While oFragments.hasMoreElements
        thisFragment = oFragments.nextElement
        iFragments = iFragments + 1
        subInspectLinks (oAnchors, thisFragment, iFragments, iLinks, iBadLinks)
    Wend
    If iBadLinks > 0 Then
        sMsg = iBadLinks & " bad link(s), " & iLinks - iBadLinks & " good link(s)"
    ElseIf iLinks Then
        sMsg = iLinks & " internal link(s) found, all good"
    Else
        sMsg = "This document has no internal links"
    End if
    MsgBox (sMsg, 64, "Find broken internal link")

End Sub

' *** END FindBrokenInternalLinks ***

现在它检查大纲编号。也许它太严格了——也许有一个关闭大纲数字检查的选项会很好。

就问题 3 而言,此代码现在打开正确的编辑链接(只要在消息框中单击“是”)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何检查 Star Basic 中损坏的内部链接? 的相关文章

  • JQuery 自动完成,结果是链接

    我正在尝试创建一个 JQuery 自动完成框 其中建议自动完成的单词是链接 类似于 Facebook 或 Quora 上发生的情况 基本上 我希望自动完成结果下拉 并且我希望人们能够单击它们并导航到不同的页面 这是我当前使用的代码
  • Asp.net 超链接控件相当于

    我想在 asp net 中定义一个 HyperLink 控件 它生成类似于以下内容的 html 输出 a href a 如何才能做到这一点 我同意 SLAks 的观点 但你就这样吧
  • 如何在 OpenOffice BASIC 宏中通过鼠标单击获取文档坐标

    背景 我想在我用鼠标单击或悬停的位置 使用按键激活时 粘贴 如 CTRL V 任何内容 最好是图像 形状 我不知道该怎么做获取我单击的文档 X Y 上的位置 Apache OpenOffice SDraw Document OpenOffi
  • 如何通过单击超链接打开文件

    我有这张桌子 我想单击链接 文件 无论什么文件 将在新的弹出窗口中打开 这是我的代码
  • AngularJS 从文本创建 html/link/anchor (escape/unescape html in view)

    我有一个具有指定值的控制器 scope post please visit http stackoverflow com quickly 我的 html 中有一些文本 p post p 我想制作一个可点击的网址链接 用锚标记包围它 我尝试将
  • 将外部链接设为 target="_blank" 是否可以接受?

    我有点困惑是否应该在我的网站上创建指向外部的链接 target blank 这种做法是否会对您网站的可用性产生负面影响 即破坏 后退按钮轨迹 大多数用户是否普遍认为它很烦人 在某些情况下可以接受 但在其他情况下则不能接受吗 我希望为我的所有
  • 如何摆脱 Firefox 中用作链接的边框和图像?

    我认为奇怪的问题更多的是我不确定它叫什么 但我有一个包含在链接中的 img example li a href link img a li Now I have the css border rules all to 0 So their
  • 消息 discord.py 中的可点击链接

    我希望我的机器人将消息发送到聊天中 如下所示 await ctx send This country is not supported you can ask me to add it here 但是为了使 这里 成为可点击的链接 在 HT
  • 在 ReportLab 中向画布元素添加超链接的最简单方法是什么?

    我正在使用 ReportLab 使用 Python 制作 pdf 我想向画布添加一个形状 并让该形状充当超链接 使以下示例中的矩形链接到 google com 的最简单方法是什么 from reportlab pdfgen import c
  • PHP:STR 替换为链接

    我有这个 PHP 聊天框 如果我在聊天框中键入链接 它不会将其显示为链接 我如何使用 STR 替换来执行此操作 它应该响应诸如 http http com nl www www 之类的内容 我的其他 STR 替换行如下所示 bericht
  • 当使用公式生成超链接时,VBA 打开 Excel 超链接不起作用

    使用公式生成的 Excel 超链接似乎存在错误 我使用的是 Excel 2010 我有一个电子表格 其中的单元格包含 URL 我的目标是执行以下两件事 将这些单元格变成超链接 创建一个键盘快捷键来打开这些超链接 这样我就不必使用鼠标了 为了
  • 如何在asp.net mvc中创建弹出窗口?

    无需使用 javascript AJAX 单击超链接时 应该打开一个新的浏览器窗口 基本 HTML 锚元素 a href http www w3schools com target blank Visit W3Schools a ASP N
  • apple-app-site-association 从 azure 请求返回为 application/JSON

    我有以下要求 当在 Azure 网站中请求文件的 URL 时 根文件夹中的可用文件必须返回到 application JSON 举例来说 我有一个名为 apple app site association 的文件 它是一个文本文件 在 az
  • 使用 CakePHP 为自定义模板链接创建分页

    我遵循分页链接的自定义模板 li class prev a href prev a li li a href class active 1 a li li a href 2 a li li a href 3 a li li a href 4
  • 在发布我的应用程序之前在 play.google 上获取我的应用程序的链接

    我想使用 facebook api 分享我的应用程序的链接 play google 上的链接 但在将应用程序发布到市场之前我必须拥有它才能将其放入我的代码中 除了发布后立即更新我的应用程序之外 还有其他解决方案吗 用这个 https pla
  • 将超链接添加到 PDF 文档中

    我目前正在扩展我们的自定义 PDF 编写器 以便能够编写网站链接 但是 我遇到了一个问题 因为我无法找到如何将链接放入 PDF 的任何地方 这是打印文本的内容 BT 70 50 TD F1 12 Tf visit my website Tj
  • 如何在D3节点中放置图像?

    到目前为止 我已经创建了这些 D3 节点 用于创建可折叠的层次树 到目前为止 这些节点的颜色为 AA1C1C 深红色 以表明如果您单击它们 它们将扩展到更多节点 我想要做的是在节点中使用图像中的位置 这对于所有用户来说都是一个加号 以知道它
  • 带有流星的网站图标?

    我正在尝试将网站图标加载到我的 Meteor 项目中 但无法让它工作 我尝试使用this https stackoverflow com questions 20054788 how to load a favicon with meteo
  • 更改焦点上可点击的 TextView 颜色并点击?

    我有一个可点击的 TextView 我想给它一些颜色 但我不知道怎么办 以下是我正在使用的两个文件中的相关代码片段 TextView title new TextView this title setLayoutParams new Lay
  • 为什么我无法在 WebView (UWP) 中打开外部浏览器中的链接?

    我正在开发一个即将完成的 Web 应用程序 该应用程序有一个本地 Web 应用程序 其中有一些链接 我想在外部浏览器 Edge Chrome 等 中打开它们 我的代码分为 3 部分 1 Windows运行时组件 using System u

随机推荐

  • 如何在 Visual Studio 代码上删除 git 存储库(laravel 项目)

    我有一个致力于 git 的小型 Laravel 项目 然后我通过手动成功删除了远程存储库 设置 gt 删除此存储库 它工作正常 但是一旦我尝试在 vs code 上创建新的存储库 然后我就得到了 git init Reinitialized
  • 使用 android.accounts 身份验证器时出现问题

    我是 android accounts api 的新手 现在我试图用它们做一些事情 但出现了一个看似虚拟的问题 我已经为我的应用程序创建了一个身份验证器 但尚未实现抽象方法 它的图标成功出现在系统 添加帐户 窗口中 我知道当我单击它时 将调
  • 关于 pthread_cond_signal 和 pthread_cond_wait

    我有以下问题pthread cond 信号 and pthread cond wait 例如 在下面的代码中 根据我的理解 当增量计数 calls pthread cond 信号 计数 125 in 观看次数只能在之后执行计数互斥体已解锁于
  • 二分查找计算平方根 (Java)

    我需要帮助编写一个程序 该程序使用二分搜索递归计算输入非负整数的平方根 向下舍入到最接近的整数 这是我到目前为止所拥有的 import java util Scanner public class Sqrt public static vo
  • xcode 4.2 位置模拟器和时区

    我在运行时注意到 xcode 模拟器中有一个漂亮的设置 我可以更改当前位置 从而模拟基于位置的测试 但是 当我尝试使用 NSDateFormatter 获取日期时 当地日期仍处于太平洋标准时间 我在太平洋时区 NSDateFormatter
  • 如何在 ios 中的联系人表视图中实现搜索栏 [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我在 viewdidload 中有以下代码 totalstring NSMutableArray alloc initWithObje
  • 比较 R 中的时间

    我有两列 例如 A 和 B 时间格式为 HH MM A B 00 00 06 00 str A 和 str B 给出 字符 我想做一个比较 例如 Comment lt ifelse hour part A lt hour part B De
  • Asp.Net System.Web.Routing 不会路由 URL,除非最后有 .aspx

    我的路由有一个奇怪的问题 我有一个现有网站 我正在尝试将其添加到其中 它有效 但前提是 aspx 位于 URL 末尾 如果我删除 aspx 则会出现错误 找不到资源 我创建了一个快速测试网站并将代码复制到其中 它工作得很好 两者之间的代码是
  • Photoshop 文本工具在文本开头添加标点符号[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我在使用 Photoshop 时遇到了一个奇怪的问题 当我使用文字工具时 我可以正常键入字母 但是当我键入任何标点符号时 它会添加到文本的
  • PG::ConnectionBad:致命:用户“用户名”错误的对等身份验证失败

    当我尝试使用 User connection 或 generic table connection 连接到我的 pg 数据库时 出现此错误 PG ConnectionBad 致命 用户 用户名 的对等身份验证失败 我仔细检查了我的datab
  • 我应该如何将 redux 与不会重用的嵌套子组件一起使用?

    我正在开发一个具有许多子组件的组件 其中一些子组件嵌套了五层 我对使用 redux 感兴趣 因为它的优点是在公共状态原子中拥有单一的事实来源 我不明白的是智能 愚蠢组件的推荐 并将提供者置于主要组件之上 并通过道具传递所有内容 如果我这样做
  • gae 样板文档

    在为 App Engine 寻找一个好的社交登录包时 我尝试了 gae boilerplate 但我发现除了自述文件之外没有任何文档 我认为这根本不够 我有很多问题 其中包括 样板文件应该用作库还是根据需要下载并修改 样板应该如何更新 每个
  • Python yaml:ModuleNotFoundError

    我在 conda 中创建了一个新环境并在那里安装了 yaml conda list grep yaml yaml 0 1 7 had09818 2 但我无法导入它 python c import yaml Traceback most re
  • 如何构建微服务前端

    Let s say I have a dozen microservices I am wondering where should the front end go Let s say front end is HTML Javascri
  • 迭代时修改 Java8 流中的对象

    在 Java8 流中 我可以修改 更新其中的对象吗 例如 List
  • 如何纠正错误“从创建它的线程以外的线程访问”?

    下面的代码给了我下面的错误 我想我需要 InvokeRequired 但我不明白我该如何使用 跨线程操作无效 从创建它的线程以外的线程访问控制 listBox1 代码 using System Collections Generic usi
  • Eclipse 中不同的断点图标有何含义?

    在 Eclipse 中使用断点时 我有时会注意到它们有不同的图标 注释 左侧栏上的标记 有时它只是一个蓝色的球 有时上面有一个复选标记 有时它是十字形的 所有这些注释是什么意思 蓝色球 常规断点 活动 可能设置了命中计数 空球 即白色 断点
  • 使用 QuickCheck 测试一元法则

    是否有用于测试的库或工具laws https wiki haskell org Monad laws自定义 monad 的 我目前的黑客尝试是这样的 Define Arbitrary1 如同Eq1 Show1 etc 定义一个包装的辅助类型
  • laravel 私有通道和 laravel-echo-server 的身份验证问题

    我在 Laravel 5 5 中使用 laravel echo server 以及 Redis 和 vuejs 通过 websockets 广播事件 通过公共渠道 它工作正常 并且事件可以正确广播到客户端 但是当我将其更改为私有通道时 即使
  • 如何检查 Star Basic 中损坏的内部链接?

    我正在为 LibreOffice Writer 创建一个基本宏来检查损坏的内部链接 简而言之 生成所有锚点的列表 循环浏览文档 查找内部超链接 如果内部超链接不在锚点列表中 则打开它进行编辑 然后停止 我的代码有一些未解决的问题 withi