The 21-year-old student became extremely distressed while testifying at the High Court in Livingston yesterday.
Moments after judge Lord Boyd said he was adjourning the trial, the woman complained of feeling breathless, then fell off her chair.
Jurors were led from the court as officials put her in the recovery position and summoned assistance. She was given chocolate and tea while she recovered before being allowed to go home.
The woman is giving evidence in the trial of Rafal Zebrowski, a pizza chef who denies sexually assaulting her and attempting to rape her in a flat near Leith on January 13 last year.
The alleged victim said the accused had walked her home from her part-time job at an Italian takeaway. She invited him in to help her revise for an important university exam she was sitting the following day.
Zebrowski, 25, who lives in Edinburgh, is alleged to have forced her mobile phone into her mouth, ripped off her clothing and tried to make her perform a sex act on him.
The trial continues.