Artcl::DeletePart (Interface: Artcl)
 
Deletes an article part.
 
void DeletePart (
    SHORT sIndex
)
 
Parameters
sIndex
[in] The index of the article part, starting from 0.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing article part) an exception is thrown. You can use GetPart to check whether an index is valid, in which case it returns true.
 
See Also
CreateArtcl
Handling article parts using the SDK
PrepareParts
GetNumParts
GetPart
CancelParts
WriteParts
 
Samples
 
C++
 
// Delete the article part with article number = "ART_001"
VARIANT vArtNumPart;
short sNumParts;
bool bNext = true, bWrite = false;

pArtcl->PrepareParts (ppaModify);

sNumParts = pArtcl->GetNumParts ();

for (short sPart = 0; bNext && sPart < sNumParts; sPart++)
{
    if (pArtcl->GetPart (sPart, NULL, &vArtNumPart, NULL, NULL) && CString (vArtNumPart.bstrVal) == "ART_001")
    {
        pArtcl->DeletePart (sPart);
        bWrite = true;
        bNext = false;
    }
}

if (bWrite)
    pArtcl->WriteParts (rmFullReport);
else
    pArtcl->CancelParts ();

C#
 
// Delete the article part with article number = "ART_001"
object oArtNumPart, oDummy;
short sNumParts;
bool bNext = true, bWrite = false;

oArtcl.PrepareParts (ePreparePartsAction.ppaModify);

sNumParts = oArtcl.GetNumParts ();

for (short sPart = 0; bNext && sPart < sNumParts; sPart++)
{
    if (oArtcl.GetPart (sPart, out oDummy, out oArtNumPart, out oDummy, out oDummy) && oArtNumPart.ToString () == "ART_001")
    {
        oArtcl.DeletePart (sPart);
        bWrite = true;
        bNext = false;
    }
}

if (bWrite)
    oArtcl.WriteParts (eReportMode.rmFullReport);
else
    oArtcl.CancelParts ();

VBS
 
' Delete the article part with article number = "ART_001"
Dim oArtNumPart, oDummy
Dim sPart, sNumParts
Dim bWrite

bWrite = False

Call oArtcl.PrepareParts(ppaModify)

sNumParts = oArtcl.GetNumParts()

For sPart = 0 To sNumParts - 1
    If oArtcl.GetPart(sPart, oDummy, oArtNumPart, oDummy, oDummy) And oArtNumPart = "ART_001" Then
        Call oArtcl.DeletePart(sPart)
        bWrite = True
        Exit For
    End If
Next

If bWrite Then
    Call oArtcl.WriteParts(rmFullReport)
Else
    Call oArtcl.CancelParts()
End If

VB.NET
 
' Delete the article part with article number = "ART_001"
Dim oArtNumPart, oDummy As Object
Dim sNumParts As Short
Dim bWrite As Boolean

bWrite = False

oArtcl.PrepareParts(ePreparePartsAction.ppaModify)

sNumParts = oArtcl.GetNumParts()

For sPart As Short = 0 To sNumParts - 1
    If oArtcl.GetPart(sPart, oDummy, oArtNumPart, oDummy, oDummy) And oArtNumPart = "ART_001" Then
        oArtcl.DeletePart(sPart)
        bWrite = True
        Exit For
    End If
Next

If bWrite Then
    oArtcl.WriteParts(eReportMode.rmFullReport)
Else
    oArtcl.CancelParts()
End If