多部分表单/数据不适用于嵌套的json我

时间:2019-05-09 07:12:57

标签: ios nsurlsession swift4.2

我正在尝试发送带有某些参数的图像,但是嵌套Public mySlide As PowerPoint.Slide Public PowerPointApp As PowerPoint.Application Public myPresentation As PowerPoint.Presentation Public MonatNum As String, JahrNum As String, MonatStr As String Sub CreateReport() Dim DestinationPPT As String Dim iSlides As Integer Dim fRowAn As Long, lRowAn As Long, lRowData As Long Dim wbEm As Workbook Dim wsEm As Worksheet Set PowerPointApp = New PowerPoint.Application DestinationPPT = "C:\VBA\ReportTemplate.pptm" Set myPresentation = PowerPointApp.Presentations.Open(DestinationPPT) Set wbEm = Workbooks.Open("C:\VBA\Report.xlsx") Set wsEm = wbEm.Sheets("Sheet1") lRowAn = wsEm.Cells(Rows.Count, 3).End(xlUp).Row fRowAn = wsEm.Cells(Rows.Count, 3).End(xlUp).End(xlUp).Row + 1 If lRowAn >= 127 Then If lRowData <= 127 Then '4 Slides, but separate Annotations from Data iSlides = 1 Call EmData(wsEm, iSlides) Call EmDataAn(wsEm, iSlides) Else '4 Slides iSlides = 3 Call EmData(wsEm, iSlides) End If Else '3 Slides Call EmData(wsEm, iSlides) End If Application.DisplayAlerts = False wbEm.Close SaveChanges:=False Application.DisplayAlerts = True PowerPointApp.Visible = True PowerPointApp.Activate Application.CutCopyMode = False End Sub Sub EmData(wsEm As Worksheet, iSlides As Integer) Dim i As Integer Dim fRowDataCalc As Long, lRowDataCalc As Long, lRowCopy As Long Dim rowHght As Long Dim rng As Range For i = 0 To iSlides fRowDataCalc = 4 + 40 * i + i * 1 lRowDataCalc = 4 + 40 * (i + 1) + i * 1 With wsEm .Range("B2:K3").Copy .Range("B500") .Range("B" & fRowDataCalc & ":K" & lRowDataCalc).Copy .Range("B502") rowHght = .Range("B3").EntireRow.Height .Range("B501").RowHeight = rowHght lRowCopy = .Cells(Rows.Count, "C").End(xlUp).Row Set rng = .Range("B500:K" & lRowCopy) End With Set mySlide = myPresentation.Slides.AddSlide(myPresentation.Slides.Count + 1, PPLayout("LayoutEmittenten")) mySlide.Shapes.Placeholders(1).TextFrame.TextRange.Text = "Headline (" & i + 1 & ")" Call PasteEm(mySlide, rng) rng.Clear Next i End Sub Sub EmDataAn(wsEm As Worksheet, iSlides As Integer) Dim lRowAn As Long, fRowAn As Long, lRowData As Long, fRowDataCalc As Long, lRowDataCalc As Long Dim rng As Range Dim rowHght As Long, lRowCopy As Long lRowAn = wsEm.Cells(Rows.Count, 3).End(xlUp).Row fRowAn = wsEm.Cells(Rows.Count, 3).End(xlUp).End(xlUp).Row - 1 lRowData = wsEm.Cells(Rows.Count, 10).End(xlUp).Row iSlides = iSlides + 1 fRowDataCalc = 4 + 40 * iSlides + iSlides * 1 lRowDataCalc = lRowData 'Last sheet with data With wsEm .Range("B2:K3").Copy .Range("B500") .Range("B" & fRowDataCalc & ":K" & lRowDataCalc).Copy .Range("B502") rowHght = .Range("B3").EntireRow.Height .Range("B501").RowHeight = rowHght lRowCopy = .Cells(Rows.Count, "C").End(xlUp).Row Set rng = .Range("B500:K" & lRowCopy) End With Set mySlide = myPresentation.Slides.AddSlide(myPresentation.Slides.Count + 1, PPLayout("LayoutEmittenten")) mySlide.Shapes.Placeholders(1).TextFrame.TextRange.Text = "Headline (" & iSlides + 2 & ")" Call PasteEm(mySlide, rng) rng.Clear 'Annotations Set rng = wsEm.Range("B" & fRowAn & ":K" & lRowAn) rng.Copy Set mySlide = myPresentation.Slides.AddSlide(myPresentation.Slides.Count + 1, PPLayout("LayoutEmittenten")) mySlide.Shapes.Placeholders(1).TextFrame.TextRange.Text = "Headline (" & iSlides + 2 & ")" Call PasteEm(mySlide, rng) End Sub Sub PasteEm(mySlide As PowerPoint.Slide, rng As Range) Dim myShape As PowerPoint.Shape rng.Copy DoEvents mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile ' = 2 Set myShape = mySlide.Shapes(mySlide.Shapes.Count) With myShape .Width = 683 .Top = 70 .Left = 5 End With End Sub 中的参数很少。我总是收到错误消息“ JSON”:“字符0周围的值无效。”

为此,我尝试了几种解决方案: 1. NSDebugDescription多部分编码 2.以字典为参数的Almofire多部分 3. Almofire以字典作为参数的多部分

但上述解决方案都不适合我

URLSession

预计服务器会响应,但不会返回任何内容。当我尝试调试时显示“ Multipart:未找到边界” 我正在尝试过去2天。有人可以帮忙吗?我认为在参数中发送嵌套JSON是一个问题。

预先感谢

0 个答案:

没有答案