投稿者 snowmansnow  (社会人) 投稿日時 2022/10/9 09:42:02

  おはようございます。るきお様
>今回の場合、ご質問は VBAからC#の自作ライブラリのメソッドを呼び出すときに、
>引数でVBA側のDouble型の配列とString型の値を渡す方法でしょうか?]
はい、その通りの状態でした。
C#に関する質問だと、こちらで面倒みてくれるのではと思いました。

VB.NETとC#が、頭の中で、ごっちゃになって、C#なのに、「as String」とか書いてエラーになり、
C#のインターフェースでは、複数の引数が使えないと勘違いして、御質問してしまいました。
今回の質問は、「ref Double[] array, String SRC, String DEST」というように
C#の書き方をする事で解決できました。

質問の仕方の注意ありがとうございます。
要点を簡潔に切り分けて、回答して頂ける方々や、見てくれる方々にわかりやすくするように注意します。何度も、ごめんなさい。

自分なりで解決した内容を一応貼り付けます。
VBA
Sub GetInkDouble3()
 
 Dim HogeIF As ClassLibrary1_ink_CL.IHogehoge3
 Set HogeIF = New ClassLibrary1_ink_CL.Hogehoge3
  
  Dim d(5) As Double
  
  d(0) = 10.5
  d(1) = 300.5
  d(2) = 50.78
  d(3) = 60.66
  d(4) = 160.66
  d(5) = 260.66
  
  Dim src As String
  Dim dest As String
  Dim p As Long

  
   src = "C:/ほげほげ/読み込む.PDF"
  dest = "C:/ほげほげ/書き出す.PDF"
  p = 1
  
  Call HogeIF.HogeMethod3(d, src, dest, p)
  
End Sub

C#が
using System;
using System.Runtime.InteropServices;
using iText.Kernel.Colors;
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Annot;
using Rectangle = iText.Kernel.Geom.Rectangle;

namespace ClassLibrary1_ink_CL
{
    [Guid("EF2CEEAD-04CB-4A86-896C-C8878A16A711")]
    public interface IHogehoge3
    {
        void HogeMethod3(ref Double[] array, String SRC, String DEST, int p);
    }
    [Guid("D3868E78-0ABA-4BB5-B22E-4DF4BFDD3F7B")]
    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("ClassLibrary1_ink_CL.Hogehoge.1")]
    public class Hogehoge3 :IHogehoge3
    {
  
        public void HogeMethod3(ref Double[] array,String SRC,String DEST, int p)
        {
            //Initialize PDF document
            PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(DEST));

            //Creating a PdfPage
            PdfPage page = pdfDoc.GetPage(p);

            //creating PdfLineAnnotation object
            Rectangle rect = new Rectangle(0, 0, 0, 0);

            PdfArray outer = new PdfArray();
            PdfArray inner = new PdfArray();

            for (int k = 0; k < array.Length; ++k)
            {
                inner.Add(new PdfNumber(array[k]));
            }
            outer.Add(inner);
            //dummy
            outer.Add(inner);

            PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rect, outer);

            // Set arrow's border style 
            PdfDictionary borderStyle = new PdfDictionary();
            borderStyle.Put(PdfName.S, PdfName.S);
            borderStyle.Put(PdfName.W, new PdfNumber(3));
            inkAnnotation.SetBorderStyle(borderStyle);

            //Setting color of the PdfLineAnnotation
            inkAnnotation.SetColor(ColorConstants.RED);

            //Setting title to the PdfLineAnnotation
            inkAnnotation.SetTitle(new PdfString("iText"));

            //Setting contents of the PdfLineAnnotation
            inkAnnotation.SetContents("Hi welcome to finddevguides");

            //Adding annotation to the page
            page.AddAnnotation(inkAnnotation);

            //Closing the document
            pdfDoc.Close();
          
        }
    }
}


です
皆さんごめんなさい。気を付けますね。