Hello Comm-Unity! I am working on a small side project, in which I am trying to make a powerpoint. However, when I try to add an image, I receive the following error:
rgumentException: Value does not fall within the expected range.
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (Int32 errorCode) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:1031)
(wrapper cominterop) Microsoft.Office.Interop.PowerPoint.Shapes:AddPicture (string,Microsoft.Office.Core.MsoTriState,Microsoft.Office.Core.MsoTriState,single,single,single,single)
(wrapper cominterop-invoke) Microsoft.Office.Interop.PowerPoint.Shapes:AddPicture (string,Microsoft.Office.Core.MsoTriState,Microsoft.Office.Core.MsoTriState,single,single,single,single)
PowerpointCreator.Add_Picture (System.String name, Single left, Single top, Single width, Single height) (at Assets/Scripts/PowerpointCreator.cs:74)
PowerpointCreator.CreateQuestionSlide (System.String question, System.String answer, System.String point_value, System.String picture_path) (at Assets/Scripts/PowerpointCreator.cs:222)
PowerpointCreator.CreateBamPresentation () (at Assets/Scripts/PowerpointCreator.cs:132)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:137)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:601)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:743)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()
This is given by the following code:
void Add_Picture(string name, float left, float top, float width, float height)
{
slide.Shapes.AddPicture (name, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, left, top);
}
void Start()
{
Add_Picture ("C:/Users/user/Pictures/Caps.jpeg", 250.0f, 100.0f, 100.0f, 100.0f);
}
I have a suspicion this is due to the path not working properly, but I can’t figure out what it could be. Thank you for looking at this post!
- tiger27