You can say:
(A) 흐어 씨는 어제 도서관에 갔대요/갔댔어요.
(B) 선생님께서 어제 도서관에 가셨대요/가셨댔어요.
B is technically different, because it's a contraction of "선생님께서 어제 도서관에 가셨다고 했어요," but assuming it's the teacher talking about themself going to the library, it should work.
When you think about it, there are actually four combinations:
도서관에 간대요/가신대요 = they say they're going to the library
도서관에 간댔어요/가신댔어요 = they said they were going to the library
도서관에 갔대요/가셨대요 = they say they went to the library
도서관에 갔댔어요/가셨댔어요 = they said they went to the library
(I think the final form is a bit wordy, and not very common.)
About the relative order of -시- and -ㄴ대(요), I think it's technically possible to say "도서관에 간다셔요", however, I think such a forms are rare and the opposite order (-신대요) is preferred.
On the other hand, here's an example (that I learned at middle school) where it does make a difference:
민수야, 선생님이 오시래 (X) = Minsu, the teacher is looking for you (literally, "the teacher tells you to come"
People may actually say this, but it's considered wrong because you attached -시- to the verb "오다", so it's as if the teacher is asking 민수 politely ("오세요"). The correct form should attach -시 to 하다 (tell):
민수야, 선생님이 오라고 하셔. = 민수야 선생님이 오라셔. (O)